Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Java, Eclipse IDE) Introduction This project will allow you to apply your knowledge of decision statements, variables, assignments, string manipulation expressions, inputs, outputs, algorithm design,

(Java, Eclipse IDE) image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Introduction This project will allow you to apply your knowledge of decision statements, variables, assignments, string manipulation expressions, inputs, outputs, algorithm design, compiling, testing, and debugging source code. After completing this project, you'll have your own program that may aid you in calculating your final numerical grade. You will write a Java application called GradeCalculator in a file called GradeCalculator.java. This application will aid a student in calculating his/her current grade in the course as well as finding the average score (s)he will need to achieve a certain letter grade. The following scale is used to compute the final letter grade in the course (we have omitted +/- letter grades for simplicity): Letter Grade Point Range 90-100 B C 80-89 70-79 Meaning Greater than or equal to 90 and less than or equal to 100 Greater than or equal to 80 and less than 90 Greater than or equal to 70 and less than 80 Greater than or equal to 60 and less than 70 Less than 60 D 60-69 Below 60 The final grade for the course will be based on the student's performance in Exam 1, Exam 2, Final Exam, Labs, Quizzes, Projects, and Participation. Your program should prompt the user for the final letter grade (she wants to obtain for the course. Then, the program should prompt the user to enter the weight each grading item carries. Afterwards, the program prompts the user if (s)he knows the score for each grading item in the course. If the user enters "y" or "yes" (ignoring capitalization), the program asks him/her the score for that grading item. Any other response is treated as a "no". The scores for each grading item are out of 100. When prompting the user for the exam scores, the program should not prompt the user for exam 2 or the final exam if the user does not know the score for exam 1. Similarly, if exam 2 is not known then the program does not prompt for the final exam score. Once the user has entered his/her desired final letter grade, the weights of all grading items and his/her known scores, the program calculates and displays the current grade based on the current scores only using the following formula: weight gi* scoregi currentScore = 2 totalKnownGradeWeight where weight of the weight of grading item gi scores the score achieved in the grading item gi totalKnown GradeWeight: sum of weights of the grading items of known scores For example, suppose that the user wants to get an A for the course and she only knows his/her scores for Exam I and Exam 2, 92 and 85 respectively. Moreover, Exam 1 carries 15% weight and Exam 2 carries 20% weight. So the user's current score is calculated as: _weightExaml * score Examt + weight Exam2 * score Exam2 currentScore = weight Exams + weight Exam2 Replacing the scores and percent weights by the user's scores and percent weight in the previous formula, the user's current score is: 15 92 + 20. 85 currentScore = ? -= 88 (15 +20) *Hint: Dividing integers may give us unexpected results. Then, the user's current letter grade is determined by checking the range his/her current score falls in the course's grade scale above. The program will display the current score and grade letter for the user. Moreover, if the user has entered a score for all the course grading items, the program should indicate in the message that score and letter grade corresponds to his/her final score and final letter. In the example above, the user's current letter grade is a 'B' according to the course's grading scale. The formula to calculate the grade average to obtain a final overall score is as follows: avgToFinalLetterGrade = 100. finalOverallScore - weight gi* scoregi 100 - totalKnown GradeWeight finalOverallScore: minimum score in the range of the letter grade the user wants to achieve in the course. weightg: the weight of the grading item gi. scoregr: the score achieved in the grading item gi. totalKnown GradeWeight: sum of weights of grading items with known scores. Note: if this value is 100 then all grades are known and you should not do the calculation (as it results in a divide by zero). The desired letter grade is achievable if the average score for the remaining grading items is not greater than a 100. If the user's desired letter grade is achievable in this semester for the student, the program prints the average score for the student to get that final letter grade. Otherwise, it prints that the user cannot achieve that letter grade for the course. In our example, the user would like to obtain an A. Therefore, according to the previous formula, (s)he then needs to score a grade average greater than or equal to 91.07692 for the labs, quizzes, projects, participation, and final exam to obtain an A for the course. Your program must display the grade average with two decimal places. If the computed average score is not exact at the second decimal place, your program should add 0.01 to the average score and then display the result with two decimal places. Alternatively, you could do some math (multiply, divide) and use Math.floor() or Math.ceil(). In the previous example, the program will display 91.08. Requirements 1. The name of the class in your Java program must be GradeCalculator. Therefore, the Java source code file must be called GradeCalculator.java. 2. You should try to make your program look just like the examples below when you run your program with the same input. 3. The input must be specified in the same order as indicated in the examples. This may seem like a minor detail but variations can cause problems for the graders - especially if they are automating the grading. 4. The desired final letter grade entered by the user should be either A, B, C, D or F (upper or lower case). Otherwise, the program will display an error message and terminate immediately. Throwing an exception is not an acceptable error message. 5. If the weights entered for the course grading items do not add up to a 100, your program should display "Weights don't add up to 100, program exiting..." and exit immediately. 6. Your program should be able to process the answers to yeso questions regardless of the case. Moreover, if the user does not input yes, y, no or n to a yeso question, the program assumes that the answer is No (example output below). 7. If the user enters a score for all values then you know the final grade. In this case, you should indicate whether or not they received the grade they wanted (example output below). 8. You can safely assume the user will always enter a grade score as an integer between 0 and 100. 9. You can safely assume the user will always enter a non-negative percent weight as an integer between 0 and 100. 10. The current user's score as well as the average score to obtain the user's desired final letter grade must be displayed with at most two decimal places. 11. Think about what it means if the avg ToFinalLetterGrade is a negative value. Handle this case with an appropriate output (it's not an error). Examples Your program should work correctly and follow the examples below. The green text is user input. Each example is a separate run of a correctly working program. Please note that some long lines of output are wrapped around multiple lines in this document, and it is okay if your output displays them on a single line. Do not assume that these examples exhaust all test cases. ----------------------------------- Example 1: weights don't add up C Grading Scale: A 90 - 100 B 80 - 89 70 - 79 D 60-69 below 60 What letter grade do you want to achieve for the course? A Enter Percentage Weights: Exam 1: 15 Exam 2: 15 Final Exam: 20 Labs: Projects: Participation: 3 Quizzes: Weights don't add up to 100, program exiting... 15 20 Example 2: user has all scores C Grading Scale: A 90-100 B 80 - 89 70 - 79 D 60-69 F below 60 What letter grade do you want to achieve for the course? A Enter Percentage Weights: Exam 1: 15 Exam 2: Final Exam: 20 Labs: 15 Projects: 20 Participation: 3 Quizzes: 7 Enter your scores out of a 100: Do you know your Exam 1 score? Score received on exam 1: 92 20 Do you know your Exam 2 score? YES Score received on exam 2: 95 Do you know your Final Exam score? Yes Score received on final exam: 91 Do you know your lab average? YES Average Lab Grade: 92 Do you know your project average? YES Average Project Grade: 85 Do you know your participation average? YES Average Participation Grade: 100 Do you know your quiz average? Yes Average Quiz Grade: 85 Current Grade Score: 90.75 Your current letter grade is a A Congratulations! You received the A that you wanted! Example 3: user has only some scores C 20 Grading Scale: A 90-100 B 80 - 89 70 - 79 D 60 - 69 below 60 What letter grade do you want to achieve for the course? B Enter Percentage Weights: Exam 1: 15 Exam 2: Final Exam: 20 Labs: 15 Projects: Participation: 3 Quizzes: Enter your scores out of a 100: Do you know your Exam 1 score? no Do you know your lab average? yes Average Lab Grade: 50 Do you know your project average? yes Average Project Grade: 80 Do you know your participation average? YES Average Participation Grade: 100 Do you know your quiz average? no Current Grade Score: 69.74 Your current letter grade is a D You have to score an average greater than or equal to 86.30 in the remaining grade items to receive an B in the course Example 4: user cannot get the desired grade Grading Scale: 90 - 100 80 - 89 70 - 79 60 - 69 below 60 What letter grade do you want to achieve for the course? A Enter Percentage Weights: Exam 1: 15 Exam 2: Final Exam 20 Labs: 15 Projects: Participation: 3 Quizzes: Enter your scores out of a 100: Do you know your Exam 1 score? Yes Score received on exam 1:32 Do you know your Exam 2 score? YES Score received on exam 2:48 Do you know your Final Exam score? YES Score received on final exam: 28 Do you know your lab average? yes Average Lab Grade: 28 Do you know your project average? No Do you know your participation average? yes Average Participation Grade: 0 Do you know your quiz average? no Current Grade Score: 33.16 Your current letter grade is a F Sorry, you cannot receive an A in the course

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions