Hello all.
I have this assignment for class and am running out of time to do this. It's due tomorrow at 11am and all of the tutors are gone since it's a Friday and I was in class all day. There are two parts to it and it's essentially a grading calculator.
The first part, the user has to input grades (integers) and once -1 is inputed, the program is supposed to stop. So I did most of it but now I'm just stuck on where to go and what's wrong. I need the program to print out what is on the bottom of the code. I'm sure you can get the gist of it once you read it.
*One of the requirements is to have one scanner in the first one and two scanners in the second. Also, the -1 that is put in can't count towards the grading calculations at the end.
Also, for the average, it has to rounded to two decimal places if needed, which is why I added in the decimal format, not sure if that's where it goes but it is needed.
In the second one, it's the same objective, but the grades are being read in from a .txt file that has grades inside of it. It has to work for any txt file given to it. Any suggestions on what to do for that code? It's pretty much the exact same...
Here's what I have. I know some of it is wrong, but this is all I could do. I also know it's missing things, I'm just not sure what they are. If anyone can help me with this that would be awesome. I'm in desperate need to get this done by tomorrow morning.
Thanks, I really hope someone can help me out with this. I really need it. The tutors are not here anymore at my school so I'm kinda desperate at this point.import java.util.Scanner; public class Grades { public static void main(String[] args) { double sum = 0; double average = 0; int gradeCount = 0; int highScore = 0; int lowScore = 100; int aCount = 0; int bCount = 0; int cCount = 0; int dCount = 0; int fCount = 0; Scanner in = new Scanner(System.in); System.out.println("Welcome to the Grade Calculator Program"); System.out.println(""); System.out.println("Please enter the student scores as integers between 0 and 100."); System.out.println("Separate the scores with a space."); System.out.println("Enter a negative number following the last student score."); System.out.print("Enter the scores here: "); while (jn.hasNext()) { String line = in.nextLine(); gradeCount ++; sum += grade; average = sum/gradeCount; DecimalFormat fmt = new DecimalFormat ("#.0#"); if (grade>=0) if (grade < lowScore) if (grade > highScore) if (grade<=100)&&(grade>=90) aCount ++; if (grade>=80)&&(grade<=89) bCount ++; if (grade>=70)&&(grade<=79) cCount ++; if (grade>=60)&&(grade<=69) dCount ++; if (grade<=59)&&(grade>=0) fCount ++; if (grade<=0) in.close; } System.out.println("Total number of grades : "+gradeCount); System.out.println("High Score : "+highScore); System.out.println("Low Score : "+lowScore); System.out.println("Average Score : "+average); System.out.println("Number of A's : "+aCount); System.out.println("Number of B's : "+bCount); System.out.println("Number of C's : "+cCount); System.out.println("Number of D's : "+dCount); System.out.println("Number of F's : "+fCount); } }
And if I'm satisfied with the help someone gives me and get this to run, I'll send them some paypal money
-Peter