Advertisement
StefanTobler

Assignment 1

Sep 8th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.57 KB | None | 0 0
  1. //MAIN ASSIGNMENT 1
  2.  
  3. import java.io.*;
  4. import static java.lang.System.*;
  5.  
  6. import java.util.Scanner;
  7.  
  8. class Main{
  9.  
  10.  
  11.      public static void main (String str[]) throws IOException {
  12.        Scanner scan = new Scanner (System.in);
  13.          
  14.        System.out.println("Please enter your test grades.");
  15.        System.out.print("Test 1: ");
  16.        double test1 = scan.nextDouble();
  17.        System.out.print("Test 2: ");
  18.        double test2 = scan.nextDouble();
  19.        System.out.print("Test 3: ");
  20.        double test3 = scan.nextDouble();
  21.        System.out.println();
  22. //       System.out.println("Test 1: " + test1 + "\n" + "Test 2: " + test2 + "\n" + "Test 3: " + test3);
  23.        System.out.println("Please enter your quiz grades.");
  24.        System.out.print("Quiz 1: ");
  25.        int quiz1 = scan.nextInt();
  26.        System.out.print("Quiz 2: ");
  27.        int quiz2 = scan.nextInt();
  28. //       System.out.println("Quiz 1: " + quiz1 + "\n" + "Quiz 2: " + quiz2);
  29.        System.out.println();
  30.        System.out.println("Please enter your homework average.");
  31.        System.out.print("Homework: ");
  32.        double hwAvg = scan.nextDouble();
  33. //       System.out.println("Homework: " + hw);
  34.        System.out.println();
  35.        double testAvg = ((test1 + test2 + test3)/3);
  36.        System.out.println("Test Average: " + testAvg);
  37.        double quizAvg = (double)(quiz1 + quiz2)/2;
  38.        System.out.println("Quiz Average: " + quizAvg);
  39.        double finalGrade = hwAvg*.25 + testAvg*.4 + quizAvg*.35;
  40.        System.out.println("Final Grade: " + finalGrade);
  41.        scan.close();
  42.      }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement