Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


COSC1073 Programming 1, Semester 2 2021


Week 6 Assessment

Create a Java Project prefixed with your student ID followed by -Week6, for example:

s1234567-Week6


Assignment Specification

1. Create two classes: (1) a class called Program which contains the main method; and (2) a class called CovidRecord.

2. Implement the CovidRecord class which contains:

● A private attribute named numDays, which is an int. This attribute represents the number of days that a COVID record covers.

● A private attribute named numCases, which is an int-typed array. This attribute represents the number of cases on each day.

● A public constructor with one argument: days, which is an int. The constructor should initialise the above two attributes, setting numDays equal to the value of days and initialising the array numCases as an empty array of length days. For example, if the value of days equals 10, numDays will be initialised as 10, and numCases will be initialised as an array of 10 integers.

● A public method named recordCases; this method prompts the user to enter the number of cases on each day in the numDays days. The method stores the user input sequentially in the array numCases. For example, if numDays equals 10, the method prompts the user to enter 10 integers, each of which corresponds to the number of cases on Day 1 to Day 10.

● A public method called printCases; this method prints the numCases array with each value separated by a comma and space, ending with a new line. Note that the last value in the array is not followed by a comma or a space, it is only followed by a new line.

● A public method called findMax; this method returns the highest number of cases in the numCases array.

● A public method called findMin; this method returns the lowest number of cases in the numCases array.

3. Write the main method. This method prompts the user to enter an integer, which indicates the number of days. The integer must be positive. You can use the Scanner class to get input from the user. You must validate the user input and if a number less than or equal to zero is entered, an error message (see Example Output below) should be displayed and the user prompted to try again; this repeats until valid input has been entered.

NOTE: You can assume all input will be integers, i.e., scanner.nextInt(); will not fail due to mismatched input.

4. After valid input is entered, create a CovidRecord-typed object with the provided number of days and then call the recordCases method, which prompts the user to enter the cases on each day. Similarly, you need to validate if the entered number of cases on each day is a non-negative integer (larger or equal than zero). In the case where the entered number for a certain day is invalid, an error message should be displayed and prompt the user to enter again, until a valid input is entered. Then call the printCases method, followed by findMax and findMin.

Lastly the program should display “Thanks for entering this Covid record.” before terminating.

See below for sample output of the program.


Sample Output

Sample output #1; with invalid input for days:

Sample output #2; with invalid input for numCases:


Marking Guide


Submission Instructions

Two forms of submissions are accepted: (1) via GitHub; and (2) via zip file.


Submit via GitHub

Accept the assignment invitation via the GitHub Classroom Link to Week 6 Assessment. After accepting this assignment, a git repository will be automatically created for you under COSC1073-2150-Programming1 organisation. Note: Please make sure your repository to be private. Otherwise, your repository will be considered as plagiarism.

Instructions to create a git repository and upload your project to GitHub can be found in Github.pdf from Week 2 learning materials.


Submit via zip file

Export the project as an archive; the file name should be the same as the project name, for example s1234567-Week6.zip and submit the zip file to Canvas under Assignments.

To export a project as a zip file in IntelliJ, click File -> Export -> Project to zip file.

Note: If you choose to submit via zip file, you do not need to accept the assignment in GitHub Classroom.


Academic Integrity and Plagiarism (Standard RMIT Warning)

Your code will be automatically checked for similarity against other submissions so please make sure your submitted project is entirely your own work.

Academic integrity is about honest presentation of your academic work. It means acknowledging the work of others while developing your own insights, knowledge, and ideas. You should take extreme care that you have:

● Acknowledged words, data, diagrams, models, frameworks and / or ideas of others you have quoted (i.e., directly copied), summarised, paraphrased, discussed, or mentioned in your assessment through the appropriate referencing methods.

● Provided a reference list of the publication details so your reader can locate the source if necessary. This includes material taken from internet sites.

If you do not acknowledge the sources of your material, you may be accused of plagiarism because you have passed off the work and ideas of another person without appropriate referencing, as if they were your own.

RMIT University treats plagiarism as a very serious offence constituting misconduct. Plagiarism covers a variety of inappropriate behaviours, including:

● Failure to properly document a source.

● Copyright material from the internet or databases.

● Collusion between students.

For further information on our policies and procedures, please refer to the University website.


Assessment Declaration

When you submit your project electronically, you agree to the RMIT Assessment Declaration.