0
How can i fix the errors? (In the output)
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) ...
+ 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 " ..
+ 1
Thanks a lot guys!
+ 1
because you use strings instead char, this may not work
if (grade == "A"){
in future use safer
if (grade.equals("A") ){