UNIVERSITY OF SOUTHERN QUEENSLAND
CSC1401 - Foundation Programming (Semester 2, 2020)
Assignment II Specification
Australian Coronavirus Confirmed Cases Calculator
Due date: 10 September 2020
Weight: 12%
Type: Individual
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 a
ays;
ï‚· 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 (Website link), as on 24 June 2020,
there have been 7521 confirmed cases of COVID-19 in Australia. There were 30 new cases in
last 24 hours. The number of confirmed cases on 24 June 2020 is as Table 1 on page 2.
Your 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/te
itory name, the
number of confirmed cases and deaths, then calculate the total number of confirmed cases, total
deaths and death rates accordingly.
https:
www.health.gov.au/news/health-alerts/novel-coronavirus-2019-ncov-health-alert/coronavirus-covid-19-cu
ent-situation-and-case-numbers
Table 1: Australian confirmed cases of COVID-19 on 24 June 2020
Functional Requirements
The program should be implemented in JavaScript and running on Firefox, a web
owser
independent to operating systems. The client has specified the following requirements for the
functionality of the program:
1. The program should be running without e
ors throughout two Phases: Information
Gathering and Information Presenting.
2. Information Gathering is to gather the information such as state/te
itory name and
the co
esponding confirmed cases and deaths for calculation of ACCC;
3. The program should first confirm with the user for willingness of entering a new
state/te
itory before proceeding to gather information of the state/te
itory name,
confirmed cases and deaths for calculation.
4. When receiving a new entry for a state/te
itory, the program should first prompt and
ask the user to enter the state/te
itory name. If the user enters nothing or an invalid
state/te
itory name, the program should alert an e
or message on the screen and then
prompt the user to re-enter. The process should iterate until a valid state/te
itory
name is entered.
5. If the entered state/te
itory name is valid, the program should then prompt the user to
input the co
esponding confirmed cases for the state/te
itory. Again, if nothing or an
invalid value is entered, the program should display an e
or message then iterate until
eceive a valid number of confirmed cases.
6. If the entered number of confirmed cases is valid, the program should then prompt the
user to input the number of deaths for the state/te
itory. Again, if nothing or an
invalid value is entered, the program should display an e
or message then iterate until
eceive a valid number of deaths.
7. After valid input of state/te
itory name, the confirmed cases and deaths, the program
should loop back to seek user confirmation for either proceeding to add one more
state/te
itory or moving to the Information Presenting phase to calculate and display
the results;
8. If the user confirms no more state/te
itory to enter, the Information Gathering phase
is completed and the program then moves to Information Presenting.
9. In the Information Presenting phase, the program prints on the web page a table
containing all entered state/te
itory(s), including information such as state/te
itory
name, the confirmed cases, deaths and death rate (death rate = deaths / the confirmed
cases).
10. To make the ACCC calculator user-friendly, the client also expects the program to
display some statistic information in the last row of the table:
- The total confirmed cases for the entered state/te
itory(s);
- The total deaths for the entered state/te
itory(s);
- The total deaths rate of the entered state/te
itory(s);
(total deaths rate = total deaths / total confirmed cases)
Respectively, Figure 1 and 2 illustrate the dataflow in Information Gathering and a sample
esult presented to the web
owser in Information Presenting.
Implementation
Task 1 - A Validation Plan for state/te
itory name
You need to implement a validation plan to get a valid input from the user for state/te
itory
name. A valid state/te
itory name needs to satisfy ALL the following criteria:
- The input should be one of the states/te
itories (New South Wales, Victoria,
Queensland, South Australia, Western Australia, Tasmania, Northern Te
itory,
Australian Capital Te
itory).
- The state/te
itory name should be case-sensitive.
Task 2 - A Validation Plan for the confirmed cases of entered state/te
itory
You need to implement another validation plan to get a valid input from the user for
confirmed cases of entered state/te
itory. A valid input needs to satisfy the following criteria:
it is a non-negative integer number.
Task 3 - A Validation Plan for the deaths of entered state/te
itory
You need to implement another validation plan to get a valid input from the user for the
deaths of entered state/te
itory. A valid input needs to satisfy the following criteria: it is a
non-negative integer number.
Task 4 - 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, 2 and 3.
Figure 1: Dataflow in Information Gathering
Task 5 - Calculate the death rate for entered state/te
itory(s)
XXXXXXXXXXdeath rate = deaths / the confirmed cases
XXXXXXXXXXcontrol 4 digits after the decimal point using toFixed()
Task 6 - Sum Plans to calculate the number of confirmed cases, deaths
Your program needs to be able to calculate the total number of confirmed cases and deaths
for all entered state/te
itory(s). The task includes:
- a sum plan to accumulate the confirmed cases of all the entered state/te
itory(s);
- a sum plan to accumulate the deaths of all the entered state/te
itory(s);
Task 7 - Presenting the Detailed Information
Print to a table the detailed information of entered state/te
itory(s) including the
state/te
itory name, the confirmed cases, deaths and death rates.
- The state/te
itory(s) should be presented as New South Wales, Victoria,
Queensland, South Australia, Western Australia, Tasmania, Northern Te
itory or
Australian Capital Te
itory.
- They are listed in descending order according to the death rates of entered
state/te
itory(s) even the state/te
itory with the largest death rates is not entered as
the first input (challenge task).
- The total confirmed cases, deaths and death rates are always presented in the last
ow of the table.
Figure 2: Sample Output of the Program
Program Integration Test
You need to test the program for all functionality thoroughly before delivering the program to
client. The program should be running appropriately without any syntax or logic e
ors.
Non-Functional Requirements
ï‚· All code should appear in the script section in the head of the HTML document. Do
not write any code in the HTML body. All functionality are delivered by JavaScript.
ï‚· In the script a
ange your code as in the following order:
(a) Constants;
(b) Variables and objects (declared and initialized);
(c) Other statements.
ï‚· Variable and constant identifiers should follow appropriate conventions.
ï‚· Code is indented appropriately and grouped in blocks according to the common tasks
attempting to.
ï‚· Appropriate comments should be added to all blocks of code. Do not simply translate
the syntax into English for comments, instead, describe the purpose of the code.
Submission
What You Need to Submit – Three Files
For a complete submission you need to submit three files as specified below. The assignment
submission system will accept only the files with extensions specified in this section.
1. Pseudocode in a file saved in .doc, .docx or .odt format:
-The pseudocode should be completed before JavaScript code.
-The pseudocode should be succinct and accurate. Refer to workshop 6 course materials.
-The pseudocode should be presented logically and clearly.
2. The program in a file saved with an .html extension contains the source code
implemented following the functional and non-functional requirements.
3. The program in a file saved with a .doc/.docx/.odt extension contains the exactly
same source code in the .html file. You can just copy from .html file and paste it to
the .doc/.docx/.odt file. If you don’t submit your code in both .doc/.docx/.odt
and .html files, or the code in .doc/.docx/.odt and .html files are different. You will
get a penalty (up to 12 marks).
Suggested Strategy
Plan to complete the assignment on time. Do not write all of the code in one sitting and
expect that everything will be working smoothly like a magic.
First step Read assignment specification carefully; clarify anything unclear by putting a post
on the assignment forum; think about how to do it, how to test it, devise high-level algorithms
for each independent part of the assignment. Begin to write program (with comments), in
incremental stages. Seek help on the assignment forum if needed.
Second step Re-read the specification carefully. Complete the "Pseudocode". Try to
implement the function in one task a time, test it and make sure it works as expected before
move to next task. Integrate all functions and finish initial coding.
Third step Fully test the program; have another review on the source code; re-read the
specification (especially marking criteria) to make sure you have done exactly what is
equired.
Marking Criteria
The assignment will be marked out of 24 and scaled down to a grade out of 12. Table 2
presents the marking criteria. If all criteria are satisfied you will receive 24 marks. If not all
criteria are met, part marks may be given. Check your own submission against these criteria
efore you submit it.
Table 2: Marking Criteria
ID REQUIREMENTS
You should submit three files. If you don’t submit