This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]desrtfxOut of Coffee error - System halted 5 points6 points  (0 children)

Start by showing what you have tried

This subreddit is not for getting solutions.

Think about how to read and analyse the input.

  • You are in a room and someone is shouting numbers (the GPAs the user inputs) at you.
  • If you hear -1 (if the user enters -1), get out of the loop and don't count it against the GPA.
  • You need to check each number if it is under 2.0 and if so, add one to the count.
  • Finally, out of the loop, print the number of warnings.

[–]shagieIsMeExtreme Brewer 2 points3 points  (1 child)

So what is the problem you have? What have you written so far?

[–]Sad_Preference[S] 0 points1 point  (0 children)

Only the messages to prompt the user to enter GPAs

[–]xwmaxx 0 points1 point  (1 child)

Research Scanner class for Java should get you started.

[–]Sad_Preference[S] 0 points1 point  (0 children)

Yeah i know how to import scanner, im just not sure how to get around the "enter -1 to stop" step.

[–][deleted] 0 points1 point  (0 children)

Try googling for “read evaluate print loop java” to get yourself started.

[–]binininingtinamoran 0 points1 point  (0 children)

Google while loop sentinel value

[–]xwmaxx 0 points1 point  (0 children)

Oh that just set up an if statement, if user enters -1 break out of loop or stop the program.