Skip to content

Instantly share code, notes, and snippets.

@BenjaminLu
Created June 23, 2016 06:03
Show Gist options
  • Save BenjaminLu/0324cf33e0c22536540b2e18e4844581 to your computer and use it in GitHub Desktop.
Save BenjaminLu/0324cf33e0c22536540b2e18e4844581 to your computer and use it in GitHub Desktop.
while (true) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
System.out.print("Enter Mid exam score : ");
double midScore = Double.parseDouble(br.readLine());
System.out.print("Enter roll call score : ");
double rollCall = Double.parseDouble(br.readLine());
System.out.print("Enter final exam score : ");
double finalScore = Double.parseDouble(br.readLine());
double total = midScore * 0.3 + rollCall * 0.3 + finalScore * 0.4;
System.out.println(total);
} catch (NumberFormatException nfe) {
System.err.println("Invalid Format!");
} catch (IOException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment