I actually did the average part for you since I was bored:
Code:
import java.util.Scanner;
public class Main {
public double total = 0, count = 0;
public double calculateAverage() {
double result = total / count;
return result;
}
public static void main(String[] args) {
boolean shouldContinue = false;
int mark = 0;
Scanner scanner = new Scanner(System.in);
do {
System.out.printIn("Enter your points:");
try {
mark = scanner.nextInt();
if(mark >= 90) {
System.out.println("You got an A!");
System.out.println("Would you like to continue? (yes/no) ");
total = total + mark;
count++;
} else {
System.out.println("You got less than an A.");
System.out.println("Would you like to continue? (yes/no) ");
}
} catch(NumberFormatException e) {
System.out.printIn("Wrong Format");
}
scanner.nextLine();
if(scanner.nextLine().contains("yes")) {
shouldContinue = true;
} else if(scanner.nextLine().contains("no")) {
shouldContinue = false;
System.out.printIn("Your grade average is: " + calculateAverage());
} else {
shouldContinue = false;
}
} while(shouldContinue);
System.out.println("Your first mark is: "+mark);
}
}
To do this part
You have to use arrays, which should be easier
allScores = new int[i];
allScores[x] = y;
and so on, just calculate the average using the array values in the end.