Reference no: EM132551275
CSC1401 - Foundation Programming Assignment - University of Southern Queensland, Australia
Assignment Specification - Australian Coronavirus Confirmed Cases Calculator
Goals and Topics - The assignment problem is straightforward. All necessary details have been supplied. The solution of the problem will use the programming concepts and strategies covered in Workshops 1-7. The subgoals are:
Obtaining advanced understanding of values, variables and arrays;
Understanding program input and output, functions and expressions;
Understanding simple strategies like iteration, validation plans;
Translating simple design into Pseudocode then JavaScript code.
The mechanics of editing, interpreting, building, running and testing a program.
Commenting source code.
Becoming confident and comfortable with programming in small problems.
Background - According to Australian Government Department of Health, as at 6:00am on 25 March 2020, there have been 2,252 confirmed cases of COVID-19 in Australia. There have been 429 new cases since 6:00am yesterday. The number of confirmed cases on 25 March 2020 is as Table 1 on page 2.
Task - In this assignment, you will design and implement an Australian Coronavirus Confirmed Cases (ACCC) calculator program for client that allows users to input the state/territory name and the number of confirmed cases, then calculate the total number of confirmed cases and average number of confirmed cases accordingly.
Functional Requirements - The program should be implemented in JavaScript and running on Firefox, a web browser independent to operating systems. The client has specified the following requirements for the functionality of the program:
1. The program should be running without errors throughout two Phases: Information Gathering and Information Presenting.
2. Information Gathering is to gather the information such as state/territory name and the corresponding confirmed cases for calculation of ACCC;
3. The program should first confirm with the user for willingness of entering a new state/territory before proceeding to gather information of the state/territory name and confirmed cases for calculation.
4. When receiving a new entry for a state/territory, the program should first prompt and ask the user to enter the state/territory name. If the user enters nothing or an invalid state/territory name, the program should alert an error message on screen and then prompt the user to re-enter. The process should iterate until a valid state/territory name is entered.
5. If the entered state/territory name is valid, the program should then prompt the user to input the corresponding confirmed cases for the state/territory. Again, if nothing or an invalid value is entered, the program should display an error message then iterate until receive a valid number of confirmed cases.
6. After valid input of state/territory name and the confirmed cases, the program should loop back to seek user confirmation for either proceeding to add one more state/territory or moving to the Information Presenting phase to calculate and display the results;
7. If the user confirms no more state/territory to enter, the Information Gathering phase is completed and the program then moves to Information Presenting.
8. In the Information Presenting phase, the program prints on the web page a table containing all entered state/territory(s), including information such as state/territory name and the confirmed cases.
9. To make the ACCC calculator user-friendly, the client also expects the program to display some statistic information:
- The state/territory(s) with the largest number of confirmed cases;
- The total confirmed cases for the entered state/territory(s);
- The average number of confirmed cases for the entered state/territory(s).
Respectively, Figure 1 and 2 illustrate the dataflow in Information Gathering and a sample result presented to the web browser in Information Presenting.
Implementation -
Task 1 - A Validation Plan for state/territory name
You need to implement a validation plan to get a valid input from the user for state/territory name. A valid state/territory name needs to satisfy ALL the following criteria:
- The input should be one of the states/territories (New South Wales, Victoria, Queensland, South Australia, Western Australia, Tasmania, Northern Territory, Australian Capital Territory).
- The state/territory name should be case-insensitive.
Task 2 - A Validation Plan for the confirmed cases of entered state/territory
You need to implement another validation plan to get a valid input from the user for confirmed cases of entered state/territory. A valid input needs to satisfy the following criteria: it is a non-negative integer number.
Task 3 - An Iteration Plan for Information Gathering Phase
You need to design an iteration plan to implement the Information Gathering Phase. Refer to Functional Requirements and Fig. 1 for the detail of dataflow in iteration. Clearly, this task should incorporate the works in Task 1 and 2.
Task 4 - A Maximum Plan to find the state/territory with the largest number of confirmed cases
Your program needs to find the entered state/territory with the largest number of confirmed cases.
Task 5 - Sum, Count, Average Plans to calculate the number of confirmed cases
Your program needs to be able to calculate the average number of confirmed cases for all entered state/territory(s). The task includes:
- a sum plan to accumulate the confirmed cases of all the entered state/territory(s);
- a count plan to count the number of state/territory(s) being entered;
- an average plan to calculate the average number of confirmed cases of all the entered state/territory(s);
- handling the "Division by Zero" exception when calculating average.
Task 6 - Presenting the Detailed Information
Print to a table the detailed information of entered state/territory(s) including the state/territory name and the confirmed cases.
- The state/territory(s) should be presented with all upper case letters.
- They are listed in ascending order according to the confirmed cases of entered state/territory(s) even the state/territory with the smallest number of confirmed cases is not entered as the first input (challenge task).
Task 7 - Presenting the Statistics
Print to an unordered list the statistic information of
- the state/territory with the largest confirmed cases;
- the total confirmed cases of entered state/territory(s);
- the average confirmed cases of entered state/territory(s) and it is an integer value;
The state/territory name should be presented with all upper case letters. The table and the list should be formatted like the screenshot in Figure 2.
Note - All required information are in attached file.
Attachment:- Foundation Programming Assignment Files.rar