debugging - Debug Exercise for Java 1 -
import java.util.*; import java.applet.*; import java.util.scanner; public class game { public static void main(string[] args){ system.out.println("i ready play!"); scanner input = new scanner(system.in); system.out.println("what's age?"); string userinput = input.nextline(); if (userinput < 13){ system.out.println("you allowed play @ own risk"); } else system.out.println("play on!"); } system.out.println("you @ iggy concert, , hear lyric 'are ready?, start running.'"); system.out.println("suddenly, iggy stops , says, 'who wants race me @ running?'"); scanner input = new scanner(system.in); system.out.println("do want race iggy on stage?"); string userinput = input.nextline(); if (userinput == yes){ "you , iggy start racing. it's neck , neck! win shoelace!"); } else system.out.println("oh no! iggy shakes head , sings 'i set pace, can race without pacing.'"); var feedback = prompt("rate game out of 10"); if(feedback > 8) { console.log("thank you! should race 1 time again @ next concert!"); } else { console.log("i'll maintain practicing coding , racing."); } } }
this assignment java 1 class in high school , have no thought how prepare of this. realize there ton of errors , pretty irrelevant me want larn java , class isn't teaching me help appreciated.
firstly start reading on java.util.scanner & read on string comparing ! not give reply hints!
some of errors : 1. need utilize .equals , not ==
string userinput = input.nextline(); if (userinput == yes)
you need int not string read on interger.parseint(string) string userinput = input.nextline(); if (userinput < 13) {}
what var , prompt ?var feedback = prompt("rate game out of 10");
console not definesconsole.log("thank you! should race 1 time again @ next concert!");
this defined twice.scanner input = new scanner(system.in);
& on !!!
java debugging
No comments:
Post a Comment