Created
June 5, 2015 00:51
-
-
Save itsJarrett/34d4cd9a0d0bd72f33ea to your computer and use it in GitHub Desktop.
GPA Calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
getGPA(); | |
} | |
public static void getGPA() { | |
Scanner s = new Scanner(System.in); | |
System.out.println("How many periods do you have?"); | |
int periods = s.nextInt(); | |
double combinded = 0; | |
for (int i = 1; i < periods + 1; i ++) { | |
System.out.println("What is your grade for period " + i + "?"); | |
double gradepoint = s.nextDouble(); | |
combinded += gradepoint; | |
} | |
double gpa = combinded / periods; | |
System.out.println("Your GPA is " + gpa); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment