PDC Competency Checkpoint 4

Transcription

PDC Competency Checkpoint 4
PDC Competency Checkpoint 4
PROGRAM DESIGN CONCEPTS
COMPETENCY CHECKPOINT 4
120
mins
This checkpoint forms part of the continuous competency assessment for this course. You must
successfully complete this and all other competency checkpoints to successfully complete this
course.
The activities in this competency checkpoint conform to particular elements for the following units
of competency:
ICAPRG405A: Automate processes
This is an assessment – instructors are not allowed to help you with these tasks. If you find that
you’re stuck, return to an earlier activity that requires the same skills, and if required, request
assistance with that activity. Then transfer that knowledge to the questions in this checkpoint.
When you have completed this checkpoint, submit the required documentation as outlined below.
If there are parts of the checkpoint that you have not completed, the assessor will not sign the
checkpoint off – you will be asked to request the sign-off again when it is complete.
Your solutions to the task should be set in Microsoft word format and must be presented in a
professional manner. The document should be titled: xxx_pdc_c4.docx where xxx is your student
number. You should also submit the HTML page that is created in the Task. This should be titled:
xxx_pdc_c4.html where xxx is your student number.
Presentation of your work is important. As such it is in your best interest to ensure that your
answers are presented in a professional manner. Make sure you clearly identify the question
number you are answering.
When you have completed this checkpoint, submit the required documentation via the PDC
Checkpoint 4 Upload link on the LMS system.



Document called xxx_pdc_c4.docx (where xxx is your student number) which contains your
answers
HTML page called xxx_pdc_c4.html (where xxx is your student number) which contains your
code
Competency Checkpoint 4 Signoff Table
If there are parts of the checkpoint that you have not completed, the assessor will not sign the
checkpoint off – you will be asked to resubmit the document when it is complete.
Computer Power Institute
1
PDC Competency Checkpoint 4
Overview
You must set out your solutions to each Task using the framework of the 10 steps of the Program
Development Routine (PDR) (Excluding step 2 on object modelling)
For each task you will need to:
1.
Analyse the problem by making a list of the sub-problems.
2.
Develop a VTOC, which is an outline of the solution.
3.
Create a Data Table after identifying the inputs, the outputs, and the actions that make up
the processing component.
4.
Write a solution algorithm in pseudo code.
5.
Desk-check the solution algorithm.
6.
Create a variables table and data flow table.
7.
Convert your algorithm to code by coding the solution in JavaScript.
8.
Run and test your program.
9.
Update documentation based on testing and running your program.
Tasks
Task 1
The Domestic Gas Supply Company wishes to calculate how much some of its customers owe based
on their gas usage.
The customers and their details are listed below:
Customer ID
1
2
3
4
5
6
Gas Usage
80
45
90
34
60
120
The company bills its customers according to the following rate:


If the customer’s usage is 60 cubic metres or less, a rate of $2.00 per cubic metre is applied.
If the customer’s usage is more than 60 cubic metres, a rate of $1.75 per cubic metre is
applied for the first 60 cubic metres, and $1.50 per cubic metre for the remaining usage.
You need to design a program using HTML and JavaScript that will prompt for the customer id and
then prompt for the amount of gas usage for the customer. From the gas usage supplied you are to
calculate how much the customer owes and print as a report on the web page.
2
Computer Power Institute
PDC Competency Checkpoint 4
At the end of the report, you are also to print some summary data of the total number of customers
and the total amount owing to the company so that it looks as follows:
Customer ID:
Customer ID:
Customer ID:
Customer ID:
Customer ID:
Customer ID:
Total amount
Total amount
1 has gas usage of 80 and owes $135
2 has gas usage of 45 and owes $90
3 has gas usage of 90 and owes $150
4 has gas usage of 34 and owes $68
5 has gas usage of 60 and owes $120
6 has gas usage of 120 and owes $195
of customers is 6
for all customers is $758
This functionality of this program is to be in a JavaScript function and called from a button click.
Hint
You need to control when the loop exits so you should design your program so that the loop is
terminated when a user enters -1 as the customer id. Use the following code as a guide.
customerid = prompt("Enter a Customer ID number", -1)
while(customerid != -1) {
// JavaScript code block followed by the following line which should
// be the last line in the while loop code block
customerid = prompt("Enter a Customer ID number", -1)
}
Computer Power Institute
3