0
8th Mar 2020, 10:22 AM
Icebreaker
Icebreaker - avatar
4 Respostas
+ 2
This should work: if (score >= 50.0){ System.out.println("You passed "+ name + "! You have "+aoran+ grade + "! Your score is "+ score); } else { System.out.println("You didnt pass " + name + "! You have " + aoran + grade +"! Your score is " + score); } But you have another problem with score. You need to put it at the beginning of your if statement. String name = "Anthony"; double score = 80.8; if(score >= 80) ...
8th Mar 2020, 10:33 AM
Denise Roßberg
Denise Roßberg - avatar
+ 2
//declare score before its uses public static void main(String[] args) { double score = 80.8; //add correct+ between strings ".." + ".." if (score >= 50.0){ System.out.println("You passed "+ name + "!" +"You have "+aoran+ grade + "!" +"Your score is "+ score); } else { System.out.println("You didnt pass " + name + "!" +"You have " + aoran + grade +"!" +"Your score is " + score); } if you want new line use "\n" special char like .. name +"!\n" +"You have " ..
8th Mar 2020, 10:34 AM
zemiak
+ 1
Thanks a lot guys!
8th Mar 2020, 10:40 AM
Icebreaker
Icebreaker - avatar
+ 1
because you use strings instead char, this may not work if (grade == "A"){ in future use safer if (grade.equals("A") ){
8th Mar 2020, 10:46 AM
zemiak