Skip to content
Advertisement

Printing results from an array seperately from user input in java

So I’m trying to create a program that takes in the student’s GPA and prints out if they are graduating at an honor’s level, graduating, or not graduating. I have most of the code figured out, but I am trying to make it so that ALL of the input is first, and then it will go back and print out whether each student is graduating. But what I am getting is printing out the graduation status for each student immediately after the input for that student.

I’m getting this:

JavaScript

When I want this:

JavaScript

Here is my code:

JavaScript

Advertisement

Answer

First you need to fill the array with values GPA we declare an array of double

JavaScript

We iterate through for loop and we ask user to enter GPA and we fill our array with those values

JavaScript

Now we have array with our values filled so what should we do know we print it by checking array values with our if statements.

JavaScript

FULL CODE

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement