CSC1401 Foundation Programming: Australian Population Growth Calculator Assignment 2 Answer
UNIVERSITY OF SOUTHERN QUEENSLAND
CSC1401 - Foundation Programming (Semester 1, 2019) Assignment II Specification
Australian Population Growth 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, minimum, and maximum plans;
- The mechanics of editing, interpreting, building, running and testing a program
- Commenting source code
- Becoming confident and comfortable with programming in small problems
According to Australian Bureau of statistics (http://www.abs.gov.au/ausstats), on 1 April 2019 at 11:24:09 PM (Canberra time), the resident population of Australia is projected to be: 25,319,757. This projection is based on the estimated resident population on 30 September 2018 and assumes growth since then with assumptions which are consistent with figures released in Australian Demographic Statistics, September Quarter 2018 (cat. no. 3101.0). The Australian population on 30 September 2018 are as Table 1:
Table 1: Australian population on 30 September 2018
Includes Other Territories comprising Jervis Bay Territory, Christmas Island, the Cocos (Keeling) Islands and Norfolk Island.
In this assignment, you will design and implement an Australian population growth (APG) calculator program for client that allows users to input the state/territory name and the population, population change over previous year, then calculate the highest growth rate and lowest growth rate accordingly.
- The program should be running without errors throughout two Phases: Information Gathering and Information Presenting.
- Information Gathering is to gather the information such as state/territory name, the population and population change over previous year for calculation of APG;
- 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, population and population change over previous year for calculation.
- 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 state/territory name is entered.
- If the entered state/territory name is valid, the program should then prompt the user to input the population and population change over previous year for the state/territory. Again, if nothing or an invalid value is entered, the program should display an error message then iterate until receive valid population and population change over previous year value.
- After valid input of state/territory name, the population and population change over previous year, 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;
- If the user confirms no more state/territory to enter, the Information Gathering phase is completed and the program then moves to Information Presenting.
- 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, the population and growth rate (Growth rate = population change over previous year/ population).
- To make the APG calculator user-friendly, the client also expects the program to display some statistic information:
- The state/territory(s) with the highest growth rate;
- The state/territory(s) with the lowest growth rate;
Respectively, Figure 1 and 2 illustrate the dataflow in Information Gathering and a sample result presented to the web browser in Information Presenting.
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).
- If user have inputted New South Wales, another input New South Wales or NEW SOUTH WALES will be an invalid input. So do other states/territories (challenge task).
- The state/territory name should be case-insensitive.
Figure 1: Dataflow in Information Gathering
Task 2 - A Validation Plan for the population of entered state/territory
You need to implement another validation plan to get valid inputs from the user for population and population change over previous year of entered state/territory. A valid input needs to satisfy ALL the following criteria:
- it is a number;
- it is an integer value between -1,000 and 10,000,000.
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 highest growth rate
Your program needs to find the entered state/territory with the highest growth rate.
Task 5 - A Minimum Plan to find the state/territory with the lowest growth rate
Your program needs to find the entered state/territory with the lowest growth rate.
Task 6 - Presenting the Detailed Course Information
Print to a table the detailed information of entered state/territory(s) including the state/territory name, the population and growth rate.
- The state/territory(s) should be presented with all upper case letters.
- They are listed in descending order according to the growth rate of entered state/territory(s) even the state/territory with the highest growth rate 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 highest growth rate;
- the state/territory with the lowest growth rate.
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.
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 errors.
In the script arrange your code as in the following order:
(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.
What You Need to Submit - Two Files.
For a complete submission you need to submit two files as specified below. The assignment submission system will accept only the files with extensions specified in this section.
-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.
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. 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 required.
Plagiarism and Academic Misconduct
USQ has zero tolerance to academic misconduct including plagiarism and collusion. Plagiarism refers to the activities of presenting someone else's work as if you wrote it yourself. Collusion is a specific type of cheating that occurs when two or more students exceed a permitted level of collaboration on a piece of assessment. Identical layout, identical mistakes, identical argument and identical presentation in students' assignments are evidence of plagiarism and collusion. Such academic misconduct may lead to serious consequences, such as:
Required to undertake additional assessment in the course
Failed in the piece of assessment
Awarded a grade of Fail for the course
Withdrawn from the course with academic penalty
Excluded from the course or the program for a period of time
Refer to USQ Policy \Academic Misconduct" for further details.