Okay so I'm doing them TheNewBoston tuts and I'm at tutorial 19 atm.
Quick question (probably no biggie for you guys)
Right now I made this;
Now I want to let the user input their weight, instead of defining it in the beginning...
In Bucky's 16th tutorial I saw this;
Below is class Bucky16b
That resulted in: "Enter name of Steffaaay here:"
And then the user could input a String.
Now I want the same thing for the weight code.
I'm probably not seeing the logic because I'm tired or IDK.
Halp please :megusta:
Quick question (probably no biggie for you guys)
Right now I made this;
Code:
public class Weight {
public static void main(String[] args) {
int weight = 60;
if(weight >= 50)
System.out.println("You're not fat at all.");
else if (weight>=60)
System.out.println("You're not fat.");
else if (weight>=70)
System.out.println("You're a bit fat.");
else if (weight>=80)
System.out.println("Loose some weight man.");
else if (weight>=90)
System.out.println("They see me rollin'");
else if (weight>=100)
System.out.println("MAN THE HARPOONS");
else if (weight>=150)
System.out.println("You're dead");
else
System.out.println("Hey mr skinny.");
}
}
Now I want to let the user input their weight, instead of defining it in the beginning...
In Bucky's 16th tutorial I saw this;
Code:
public class Bucky16 {
private String girlName;
public void setName(String name){
girlName = name;
}
public String getName(){
return girlName;
}
public void saying(){
System.out.printf("Your awesome girlfriend is %s", getName());
}
}
Below is class Bucky16b
Code:
import java.util.Scanner;
public class Bucky16b {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Bucky16 Bucky16Object = new Bucky16();
System.out.println("Enter name of Steffaaay here: ");
String temp = input.nextLine();
Bucky16Object.setName(temp);
Bucky16Object.saying();
}
}
That resulted in: "Enter name of Steffaaay here:"
And then the user could input a String.
Now I want the same thing for the weight code.
I'm probably not seeing the logic because I'm tired or IDK.
Halp please :megusta: