/* * Intro to Programming CSE 1310 * University of Texas at Arlington */ package code24jan19; import java.util.Scanner; /** * * @author jcmtiernan */ public class Code24Jan19 { /** * Program to calculate a semester grade in Dr T's 1310 class. * @param args the command line arguments */ public static void main(String[] args) { /* Declare the variables Put the values in variables Add the quizzes and average Mult final exam by 30% Average labs and mult by 50% Add XC service to labs value Add T1 and T2 and mult by 20% Add tests and quizzes Tests + labs + final exam = course grade */ // Declare the variables double q1, q2, q3, q4; // quiz values double t1, t2; // test values double l1, l2, l3, l4, l5 , l6; // lab values double xc; // extra credit service value double finalExam; // Put the values in variables /* Quiz 1 – 10 points out of 10 possible max points Quiz 2 – 9 pts out of 10 max Test 1 – 86 / 100 Lab 1 – 92 / 100 Lab 2 – 94 / 100 Quiz 3 – 7 / 10 Lab 3 – 86 / 100 Test 2 – 78 / 100 Lab 4 – 65 / 100 Extra Credit Service 3 points / 3 max Lab 5 – 70 / 100 Lab 6 – 82 / 100 Quiz 4 – 10 / 10 Final exam – 75 / 100 */ q1 = 10; q2 = 9; t1 = 86; l1 = 92; l2 = 94; q3 = 7; l3 = 86; t2 = 78; l4 = 65; xc = 3; l5 = 70; l6 = 82; q4 = 10; finalExam = 75; Scanner input = new Scanner(System.in); System.out.println("Please enter six values representing lab grades. \n" +"Separate the values with ONLY spaces.\n" +"Values should be between 0.0 and 100.0 "); l1 = input.nextDouble(); l2 = input.nextDouble(); l3 = input.nextDouble(); l4 = input.nextDouble(); l5 = input.nextDouble(); l6 = input.nextDouble(); //Add the quizzes and average double qAvg = (q1 + q2 + q3 +q4)/4; System.out.println("Quiz avg = "+qAvg); //Mult final exam by 30% double pctFinalExam = finalExam * .3; System.out.println("finalExam % value toward final grade = "+pctFinalExam); //Average labs and mult by 50% double pctLabAvg = (l1 + l2+ l3 + l4+ l5+ l6)/6 * .5; System.out.println("Labs % value toward final grade = "+pctLabAvg); //Add XC service to labs value pctLabAvg = pctLabAvg + xc; System.out.println("Labs % value + XC toward final grade = "+pctLabAvg); //Add T1 and T2 and mult by 20% double pctTestAvg = (t1 + t2)/2 * .2; System.out.println("Tests % value toward final grade = "+pctTestAvg); //Add tests and quizzes pctTestAvg = pctTestAvg + (qAvg * .3); System.out.println("Tests % value + quizzes toward final grade = "+pctTestAvg); // Tests + labs + final exam = course grade double courseGrade = pctTestAvg + pctLabAvg + pctFinalExam; System.out.println("Final course grade = "+pctTestAvg +" + " + pctLabAvg +" + "+ pctFinalExam+ " = "+courseGrade); // Choices /* Class has 3 tests worth 60% of final grade Final 40% Do a research project 40% OR Take two more tests for 40% of grade OR Write 8 lab reports for 40% of grade Assumption: all grades are out of 100 Algorithm for final grade: Average the 3 tests and mult by percentage (60) Find out how they are doing the final 40% if student chose the research project multiply project grade by 40% and save as final40Pct else if student chose two tests Average the 2 tests and mult by percentage (40) and save as final40Pct else if student chose 8 reports Average 8 reports and mult by percentage (40) and save as final40Pct // Final grade is 3 test value plus whichever they chose Final grade is 3 test value plus final40Pct */ } }