Computer Lab. Week 2 - An Introduction to Pseudo Code


Home


*** This tutorial contains Assessable Tutorial A ***

This is a continuation of the previous tutorial.

In the last tutorial you should have developed a Defining Diagram for the following problems. In this tutorial you are to develop the Algorithm (Pseudo Code and Data Dictionary) for each problem. The Steps in Program Development (so far) are:

Step 1: Understand the Problem (From the last tutorial)

Step 1a: Read the problem carefully
Step 1b: Check your understanding of the problem

Step 2: Specify a High Level Solution (From the last tutorial)

Step 2a: Determine the outputs
Step 2b: Determine the processing (actions)
Step 2c: Determine the inputs
Step 2d: Develop a Defining Diagram

Step 3: Outline the Solution

Step 4: Develop the Algorithm

Step 4a: Pseudo Code
Step 4b: Data Dictionary

Question 1

Write Pseudo Code and a Data Dictionary for Question 1 in the previous tutorial. The problem is described again below:

Problem Description

A draftsperson requires a program to calculate the area of rectangular rooms. The user is to input the length and width of the room, the program is to then calculate the area of the room and the length of the perimeter, and then display the area and perimeter length. The area of a rectangle is its length multiplied by its width. The length of the perimeter of a rectangle is twice the length plus twice the width.

Example Program Runs

Run
Length (m) ? 10
Width (m) ? 5
Area = 50.0
Perimeter = 30.0

Run
Length (m) ? 2.5
Width (m) ? 4
Area = 10.0
Perimeter = 13.0

Question 2

Write Pseudo Code and a Data Dictionary for Question 2 in the previous tutorial. The problem is described again below:

Problem Description

A shop owner requires a  program to calculate the amount of change to be given to a customer. The price of the item sold and the amount of cash tendered by the customer is to be input and the amount of change is to be calculated and displayed.

Example Runs

Run
Price ($) ? 8.95
Cash ($) ? 10.00
Change = $1.05
Run
Price ($) ? 20.00
Cash ($) ? 20.00
Change = $0.00

Question 3

Write the Pseudo Code and Data Dictionary for Question 3 in the previous tutorial. The problem is described again below:

How is the final mark calculated?

Problem Description

A subject has an assignment and an exam. Both the assignment and exam are marked out of 100. The assignment contributes 40% towards the assessment of the subject and the exam 60%. A program is required that allows the user to input and assignment mark (out of 100) and an exam mark (out of 100) and display an overall mark in the proportions specified.

Example Runs

Run
Assignment mark (0 to 100) ? 70
Exam mark (0 to 100) ? 60
Final mark = 64%
Run
Assignment mark (0 to 100) ? 80
Exam mark (0 to 100) ? 90
Final mark = 86%

Question 4

Write Pseudo Code and a Data Dictionary for Question 4 in the previous tutorial. The problem is described again below:

Why difficulty is there in writing the Pseudo Code for Question 4 from the previous tutorial?

Problem Description

The Water Board gives a discount of 5% to customers that pay their rates bill early, otherwise the normal rate applies. The program is to display the discount (if applicable) and the amount due.

Example Runs

Run
Amount Due ($) ? 200.00
Early payment (Y=Yes, N=No) ? Y
Discount = $10.00
Discounted Amount Due = $190.00
Run
Amount Due ($) ? 100.00
Early payment (Y=Yes, N=No) ? N
Amount Due = $100.00

Assessable Tutorial A

Due Date: Computer Lab. Week 3
Marks: 2%

The problem described in Question 2 above is to be used for Assessable Tutorial A.

Some information on Assessable Tutorials

Hand In

Hand in a printout of a document containing the following:

  1. A title page as specified below and
  2. A Defining Diagram for question 2 above
  3. Pseudo Code and Data Dictionary of question 2 above

Requirements

1. Title Page

Include a title page with your assessable tutorial, with the following information, in the order shown:

Assessable Tutorial A

 

Name:

Subject:

Tutorial Group:

Tutor:

Due date:

Hand the tutorial to your tutor in one of your tutorial classes on or before the Lab session in week 3.

If you are unsure about which tutorial group you are in, refer to the tutorial group listing.

The assessable tutorial will be handed back in a later tutorial class.


Written by Tim Whitfort.