I have no experience with java at all but its for school project and I'm just confused and have tried to look around for my answer but it just wasnt going anywhere so I'll try asking here. That is what I tried to do. I basically need to get all the values from newgrade and sum it up. I know it has to do something with arrays but I do not know how to do it. itd be very helpful if i could get a clear and simple way of doing it. thank you
import java.util.Scanner;
public class QPI
{
public static void main(String args[])
{
int grade, response,total,qpi;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter your quality point equivalent for each subject:");
grade = scanner.nextInt();
if (grade == 4 )
System.out.println("A");
if (grade == 3.5 )
System.out.println("B+");
if (grade == 3 )
System.out.println("B");
if (grade == 2.5 )
System.out.println("C+");
if (grade == 2 )
System.out.println("C");
if (grade == 1 )
System.out.println("D");
if (grade == 0 )
System.out.println("F");
System.out.println("Enter your total units for this subject:");
total = scanner.nextInt();
int newgrade = total*grade;
System.out.println(newgrade);
System.out.println("type 1 to continue adding type 2 to calculate qpi:");
response = scanner.nextInt();
if (response == 1);
do {
System.out.println("Enter your quality point equivalent for each subject:");
grade = scanner.nextInt();
if (grade == 4 )
System.out.println("A");
if (grade == 3.5 )
System.out.println("B+");
if (grade == 3 )
System.out.println("B");
if (grade == 2.5 )
System.out.println("C+");
if (grade == 2 )
System.out.println("C");
if (grade == 1 )
System.out.println("D");
if (grade == 0 )
System.out.println("F");
System.out.println("Enter your total units for this subject:");
total = scanner.nextInt();
newgrade = total*grade;
System.out.println(newgrade);
System.out.println("type 1 to continue adding type 2 to calculate qpi:");
response = scanner.nextInt();
} while (response != 2);
if (response == 2);
qpi = newgrade/total;
System.out.println("Your QPI is:" + qpi);
}
}