I have my code here and I am getting errors (I have also attached my code): " import java.util.Compiler; public class Test Score { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Ënter the first exam Score: "); Double Score1 = scan.nextDouble(); System.out.println("Enter the second exam Score: "); Double Score2 = scan.nextDouble(); System.out.println("Enter the third exam Score: "); Double Score3 = scan.nextDouble(); System.out.println("Enter the fourth exam Score: "); Double Score4 = scan.nextDouble(); System.out.println("Enter the fifth exam Score: "); Double Score5 = scan.nextDouble(); Double total = Score1 + Score2 + Score3 + Score4 + Score5 Double average = total/5; if (average >= 90) { System.out.printf("your average was a: %f and recieved an A in this Class", average ); } else if (average >= 80) { System.out.printf("your average was a: %f and recieved an B in this class", average ); } else if (average >= 70) { System.out.printf("your average was a: %f and recieved an C in this class", average ); } else if (average >= 60) { System.out.printf("your average was a: %f and recieved an D in this class", average ); } else { System.out.printf("your average was a: %f and recieved an F in this class", average ); } }" What is wrong with my code? Also, how can I input this information: " Write a program that ask the user to enter a list of positive scores until the user enters a negative score to terminate the input. You need to store these scores in an array. You can assume the maximum number of scores the user may enter is 50. However, you need to keep track of the actual number of scores entered. Write 2 methods: 1. calculateAverage(): this method takes the list of scores and return the average score. 2. countPerfectScores(): this method takes the list of scores and return the number of perfect scores (100). The main program reads the input and calls these methods and print the results. Please make sure you write a comment line to document what your method does."
I have my code here and I am getting errors (I have also attached my code): "
import java.util.Compiler;
public class Test Score {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Ënter the first exam Score: ");
Double Score1 = scan.nextDouble();
System.out.println("Enter the second exam Score: ");
Double Score2 = scan.nextDouble();
System.out.println("Enter the third exam Score: ");
Double Score3 = scan.nextDouble();
System.out.println("Enter the fourth exam Score: ");
Double Score4 = scan.nextDouble();
System.out.println("Enter the fifth exam Score: ");
Double Score5 = scan.nextDouble();
Double total = Score1 + Score2 + Score3 + Score4 + Score5
Double average = total/5;
if (average >= 90) {
System.out.printf("your average was a: %f and recieved an A in this Class", average );
} else if (average >= 80) {
System.out.printf("your average was a: %f and recieved an B in this class", average );
} else if (average >= 70) {
System.out.printf("your average was a: %f and recieved an C in this class", average );
} else if (average >= 60) {
System.out.printf("your average was a: %f and recieved an D in this class", average );
} else {
System.out.printf("your average was a: %f and recieved an F in this class", average );
}
}"
What is wrong with my code?
Also, how can I input this information: "
Write a program that ask the user to enter a list of positive scores until the user enters a negative score to terminate the input. You need to store these scores in an array. You can assume the maximum number of scores the user may enter is 50. However, you need to keep track of the actual number of scores entered. Write 2 methods:
1. calculateAverage(): this method takes the list of scores and return the average score.
2. countPerfectScores(): this method takes the list of scores and return the number of perfect scores (100).
The main program reads the input and calls these methods and print the results.
Please make sure you write a comment line to document what your method does."
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images