Write a program that calculates your provisional final grade in Java! Read a fil
ID: 3767693 • Letter: W
Question
Write a program that calculates your provisional final grade in Java!
Read a file that contains each grade
Each type of grade is denoted by a header and every grade are on separate lines. See the test files (http://bit.ly/1TmbUxX) for how it should be formatted.
Lab assignment average is 20% of your grade
Homework assignment average is 30% of your grade
Drop the lowest grade
Lab Test 1 is 10% of your grade
Lab Test 2 is 10% of your grade
Exam 1 is 10% of your grade
Exam 2 is 10% of your grade
Final Exam is 10% of your final grade
Extra Credits are worth 2% a piece
This adds up to 110% but the final grade is taken out of 100
A is 90-100
B+ is 85-89
B is 80-84
C+ is 75-79
C is 70-74
D+ is 65-69
D is 60-64
F is anything below 60
Round up to the nearest whole number
HINT: Math.ceil
Print out the provisional final grade at the end.
Example Dialog:
Your lab average is 92
Your homework average is 90.0
Your first exam is 65.0
Your first lab exam is 100.0
Your second exam is 65.0
Your second lab exam is 100.0
Your extra work total is 4.0 points
Your final is 80.0
Your raw total is 91.0
Your final grade is A
Explanation / Answer
import java.util.Scanner; public class UserInteraction { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int choice = 0; String[] subjects = new String[10]; int grades[] = new int[10]; double sum = 0.0; do { System.out.println("1. Enter a course name and a grade"); System.out.println("2. Display all grades"); System.out.println("3. Calculate the average grade"); System.out.println("4. Exit program"); choice = scan.nextInt(); if ( choice == 1 ) { Scanner scansubjects = new Scanner(System.in); Scanner scangrades = new Scanner(System.in); System.out.println("Enter 10 subjects and their corresponding grades:"); System.out.println(); int i = 0; for( i = 0; i < 10; i++ ) { System.out.println("Subject:"); String temp = scansubjects.nextLine(); subjects[i] = temp.toLowerCase(); System.out.println("Grade:"); grades[i] = scangrades.nextInt(); if( i == ( subjects.length - 1 ) ) { System.out.println("Thank you!"); System.out.println(); } } } if ( choice == 2 ) { System.out.println("Subjects" + " Grades"); System.out.println("---------------------"); for(int p = 0; pRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.