5.1 Step 4 (above) showed that we can use if-statements to perform checks and we can get the user to enter values for our programs to process. Create a new Java project and get either the ‘full example of Scanner’ or ‘full example of JOptionPane’ from the ‘taking inputs’ notes to work. 5.2 Continue to the modify the program from 5.1 as follows (must follow instructions exactly):
1. Rename the class so that it says “public class CPT120GradeMaker” instead.
2. Ask the user to enter 3 separate mark inputs either by using JoptionPane or Scanner: (1) An “IIE total”, (2) an “assignment total” and (3) an “exam total”. What data type would you use for storing the values and explain what other options would have been there (along with pros and cons) in a code comment.
3. Calculate the non-exam total by adding the IIE total with the assignment total. The non-exam total should be capped to 50, if it goes over. Explain in a comment how you achieve this. E.g. if the IIE total is 25 and the assignment total is 27, the non-exam total must be 50. 4. Calculate the final course mark (an integer) by adding the non-exam total with the exam total then round up any decimal places to the next nearest int. E.g. if the non-exam total is 50 and the exam total is 33.1, the final course mark must be rounded up from 83.1 to 84. Hint: You need to independently investigate in the Math class documentation for a suitable method that would round values up to the nearest int and additionally any related examples online.
5. Using the criteria given in the RMIT Higher Education Grades page for numerical mark ranges, determine and display either the grade code or grade alongside the calculated total. E.g. “84 HD”.
Note: Input validation is covered in the while-loops lesson. There is no need to validate the user inputs. You may assume that the user will enter positive values and in the requested data type (e.g. will not enter text when a int is asked for, etc.).