Jump to content

package JobHelper;

//Imports
import java.util.Scanner;

//Class
public class JobHelper {

    //Variables
    static int Engineer = 0;
    static int Artist = 0;
    static int Entertainment = 0;
    static int Computers = 0;
    static int Teacher = 0;
    static int Nothing = 0;
    static int Medical = 0;
    static int LawEnforcment = 0;
    static int Scientist = 0;
    static int Transportation = 0;
    static String QuestionOne;

    //Coinstructor 
    public JobHelper() {
        this.Engineer = Engineer;
        this.Artist = Artist;
        this.Entertainment = Entertainment;
        this.Computers = Computers;
        this.Teacher = Teacher;
        this.Nothing = Nothing;
        this.Medical = Medical;
        this.LawEnforcment = LawEnforcment;
        this.Scientist = Scientist;
        this.Transportation = Transportation;
        this.QuestionOne = QuestionOne;
    }

    //Getters
    public int getEngineer() {
        return Engineer;
    }

    public int getArtist() {
        return Artist;
    }

    public int getEntertainment() {
        return Entertainment;
    }

    public int getComputers() {
        return Computers;
    }

    public int getTeacher() {
        return Teacher;
    }

    public int getNothing() {
        return Nothing;
    }

    public int getMedical() {
        return Medical;
    }

    public int getLawEnforcment() {
        return LawEnforcment;
    }

    public int getScientist() {
        return Scientist;
    }

    public int getTransportation() {
        return Transportation;
    }

    public String getQuestionOne() {
        return QuestionOne;
    }

    //Methods    
    public void Engineer() {
        if (QuestionOne == "yes") {
            Engineer = 5;
        }
    }

    public void Artist() {

    }

    public void Entertainment() {

    }

    public void Computers() {

    }

    public void Teacher() {

    }

    public void Nothing() {

    }

    public void Medical() {

    }

    public void LawEnforcment() {

    }

    public void Scientist() {

    }

    public void Transportation() {

    }

    public static void main(String[] args) {
        Scanner ScQ1 = new Scanner(System.in);
        System.out.println("Do you like music yes/no?");
        QuestionOne = ScQ1.nextLine();
        if (Engineer >= 1) {
            System.out.println("It worked!"); 
        } else {
            System.out.println("Not working"); 
        }
    }
}

 

Everything i try has gotten me a not working, i can not figure out how to take the users input and use it in my if statement in order to set my variable equal to a number. Thanks everyone for your help!

I run my own indie game company called Color Dragon Studios where we are currently making a 2d platformer game called Small Earth.

Link to comment
https://linustechtips.com/topic/679007-please-help/
Share on other sites

Link to post
Share on other sites

please edit your post so the code is in code tags.

 

to call the function change

QuestionOne = ScQ1.nextLine();

to

QuestionOne(ScQ1.nextLine());

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/679007-please-help/#findComment-8736210
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×