COIT 20245 Java Console Program :
Introduction to Programming
COIT 20245 Java Console Program Assessment item 1—Java Console Program
|Due date:||Week 6 T123 – Midnight, Friday 21 April 2023 Refer below for complete assessment item 1 requirements. (Assignment One)||ASSESSMENT|
This assessment item relates to the course objectives as in the Unit Profile.
Details for Java Program
For this assignment, you are required to develop a Java Console Program to demonstrate you can use Java constructs including input/output via a command line, Java primitive and built-in data types, Java defined objects, selection and looping statements, methods, and various other Java commands. Your program must produce the correct results.
You are only allowed to use techniques which have been covered in the first six weeks of the unit, you must use the Scanner object for input and no advanced data structures like arrays will be used. Instructions for this appear in the implementation section of this specification.
If you do not only use techniques from the first six weeks of the unit you could lose substantial marks.
What to submit for this assignment:
The Java source code:
A COIT 20245 Java Console Program report including a flow chart (UML activity diagram) to depict your validation loop for reading the number of marks (not the whole program), how long it had taken to create the program, any problems encountered, and screenshots of the output produced. (Use Alt-PrtScrn to capture just the console window and you can paste it into your Word document). You should thoroughly test your program and outline your testing plan and annotate your screenshots with what you are testing.
Include “known results” with results you have calculated yourself.
Important: For this assignment, you are required to paste your source code (as text) in an appendix into your report, do not worry about the formatting loss. If you do not paste your source code as text (no screen shot images) you could lose substantial marks.
You will submit your files by the due date using the “Assignment 1 Submission” link on the Moodle unit website in the Assessment Block or in the assessment tile.
Rocky College program.
Rocky College offers diploma courses (one year) for easy entry into university courses. Major universities have agreed to give students full credit for the units they have studied at Rocky College.
Rocky College boasts small class sizes, state of the art facilities and one on one help if required.
You are to write a program to allow unit coordinators to process results and display statistics for their unit.
You are to write a Java Console Application (RockyCollege.java) which will allow unit coordinators to enter the details of N student names and their mark. N should be equal to the highest digit in your student ID, use N=4 if your highest digit is less than four.
Initially (only once at the beginning of the program), the coordinator will be prompted to enter the unit code for their unit. You must write a validation loop to ensure the unit code is not empty.
In the loop for each student the program will prompt for and accept the student’s name and the mark of student. The student’s name cannot be empty, and the mark must be between zero and one hundred inclusively (these values should be constants). You must write validation loops for these values.
Number the student in the prompt for the name and include the student’s name in the prompt for the mark.
Sample pseudocode for a validation loop:
Prompt and read a value WHILE the value is incorrect
Prompt and read a value (again) END WHILE
Once you have verified the student’s mark you need to calculate the grade for the student using the following cut-off values (use a series of if – else if statements):
A mark greater than or equal to 85 the grade will be “HD”.
A mark greater than or equal to 75 and less than 85 the grade will be “D”. A mark greater than or equal to 65 and less than 75 the grade will be “C”. A mark greater than or equal to 50 and less than 65 the grade will be “P”. A mark less than 50 the grade will be “F”.
The charge for each unit is $2,000.
Rocky College wants to reward high achieving students by giving them a rebate on the unit charge as follows:
A student which receives a grade of “HD” will receive a rebate of 10% on their unit charge.
A student which receives a grade of “D” will receive a rebate of 5% on their unit charge. A student which receives a grade of “C” will receive a rebate of 2% on their unit charge. Students with a grade of “P” or “F” will not receive any rebate.
When N students have been entered, you will output a heading for the statistics “Statistical information for <unit code>”, the minimum and maximum marks and the student names with these minimums and maximums, and then what the average number of marks per student is (formatted to two decimal places) (see sample output below). Note: If more than one student has an equal maximum or minimum marks you just need to only output one of these cases. Also, the total of the rebates will be output.
Display a welcome message at the beginning “Welcome to the Rocky College Management System” and an end message e.g. “Thank you for using the Rocky College Management System” and the final line “Program written by <your student ID>” (see sample output below).
Many students have never written a program before so this is a fairly simple assignment which can be written in the main method of your class. Follow the steps outlined here and build your program up in a step-by-step fashion and always compile your program at each stage so you are always working on error-free code.
Start by creating your Rocky College class which will contain just the main method, COMPILE! (Fix any errors and repeat).
Please include a header comment which includes your name, student ID, date, filename and a brief description of the program.
Implement the welcome message, COMPILE, RUN and TEST! Prompt for and read the unit code, COMPILE, RUN and TEST! Declare your Scanner object(s), COMPILE!
Note: In order to combat the problem of the Scanner objects reading both textual and numeric
data a good way to counter this is to declare two Scanner objects, one for reading text and another for reading numbers, or you can clear the buffer after the int read using nextLine(). This might not be considered “best practise” but will be sufficient for this unit.
Create a loop to iterate N Times, COMPILE, RUN and TEST! (use N = 4 for development)
Declare variables to hold the student’s name and the mark (String and double), COMPILE, RUN and TEST!
Within the loop: prompt and read the student’s name, COMPILE, RUN and TEST! Add the prompt and read for the mark for the student, COMPILE, RUN and TEST!
Calculate the grade for the student using the grading structure above, COMPILE, RUN and TEST until this is correct.
Calculate the rebate for the student, using the rebate structure above, COMPILE, RUN and TEST!
Output the description of the student result (see sample output below) Output all marks, dollar values and average to two decimal places:
USE: System.out.printf(“%.2f”, mark);
Add the validation loops for reading the data (you can do this last if you like)
Use if statements to determine if the mark is a maximum or minimum, (you will have to think about this). Output the minimum and maximums after the loop, COMPILE and RUN until you have this correct. You may want to set your original max and min variables to the minimum and maximum possible marks respectively.
You will need to add up the marks entered as you go so you can calculate the average.
After the loop, you will output the statistics which you have gathered in the loop. You should have the maximum and minimum marks and the corresponding student’s names and the total amount of rebates given.
Calculate the average mark per student (ensure you are performing a floating-point calculation). Output the statistics as indicated in the screen shot below.
Finally, print the end message.
Your program should be well laid out, commented, and use appropriate and consistent names (camel notation) for all variables and objects.
For this assignment, you will not worry about checking data type mismatches.
Refer to a Java reference textbook and the unit and lecture material (available on the course WEB site) for further information about the Java programming topics required to complete this assignment. Check the marking guide (last page) to ensure you have completed every task. You need to match the output as shown below including line spacing.
Typical screen shot of the program executing is as follows:
Validating the unit code.
Validating student name and mark entered.
Complete output of the program:
Good luck — Bruce McKenzie unit coordinator Term 1 2023 [email protected]
|Total number of marks – 20|
|Variables, constants and types|
|Constant N is used correctly and is largest digit of student ID||0.5|
|Constants are used for all numeric literals (no hard-coded values)||1.5|
|Variables have meaningful names and use camel notation||0.5|
|Variables are the correct type||0.5|
|Code in general|
|Code is indented and aligned correctly||0.5|
|Code has header comment which includes your student name, student ID, date, file name and purpose of the class||0.5|
|Comments, non valued comments will not receive full marks||1|
|Numbers and strings are read correctly||0.5|
|Validation loop for unit code and student’s name is correct||1|
|Validation loop for the student’s mark is correct||1|
|if statements are correct||0.5|
|looping is correct i.e iterates N times||0.5|
|Output is formatted correctly (matches sample output)||1.5|
|Correct grade and rebate per student is correct||1.5|
|Minimum mark and student’s name are correct||1|
|Maximum mark and student’s name are correct||1|
|Average mark per student is correct||1|
|Total rebate is correct||0.5|
|Average and dollar values formatted to two decimal places||1|
|Welcome and exit message (with student ID) are displayed||0.5|
|Correct files submitted including types and names||0.5|
|Flow chart is correct||1|
|Screen shot(s) of testing, testing plan and annotations||1.5|
|Report presentation and comments including how long it took and any problems encountered||0.5|
|Penalty for late submission is 5% per day (1 mark per day) enter negative number|
|Compilation errors and other penalties, enter negative number|