You are on page 1of 2

F60C44 – Introduction to C Programming

Group Assignment (20%)

Due date : 25th April 2010 (Week 12 - Monday)


Group work : 2 – 3 members

 Those who are working in pairs should select any TWO questions.
 Those who are working in a group of three should select any THREE questions.

Question 1

The National Earthquake Information has asked you to write a program implementing the
following decision table to characterise an earthquake based on its Richter scale number.

Richter Scale Characterisation


Number (n)
n < 5.0 Little or no damage
5.0 ≤ n 5.5 Some damage
5.5 ≤ n 6.5 Serious damage: walls may crack or fall.
6.5 ≤ n 7.5 Disaster : houses and buildings may collapse
higher Catastrophe: most buildings destroyed. Issue Tsunami
warning

Your program should display a meaningful output message and/or invalid message for each
input and should continue until user decides to terminate the program. You can add more
characterisation details for each Richter scale.

Question 2

Write a program that will calculate and print bills for the City Power company. The rates
vary depending on whether the use is residential, commercial, or industrial. The rates
computed as follows:
Residential $6.00 plus $0.052 per kwh used
$60.00 for the first 1000kwh and $0.045 for each additional
Commercial kwh
Rate varies depending on time of usage:
Peak hours : $76.00 for the first 1000 kwh and $0.065 for
Industrial each additional kwh.
Off peak hours : $40.00 for first 1000kwh and $0.028 for
each additional kwh

Your program should prompt the user to enter an account number, the code (either
residential, commercial or industrial) and the necessary consumption figures in whole
numbers of kilowatt-hours. Your program should continue until users decide to quit and
should display Invalid data entry messages.

Page 1
Question 3

Write a program to process a collection of daily high temperatures. Your program should
count and print the number of hot days, the number of pleasant days and the number of
cold days. It should also display the category of each temperature. You should design the
category and the range of temperatures for each category. Print invalid data entry message
and prompt user to enter the valid input again.

Question 4

Write a program to model a simple calculator. You program should accept a pair of integers
(operands) and operators [addition / subtraction / multiplication / division and power (^)].
Design the output to display the entered values and the result of the arithmetic operations.
Your program should continue until users decide to quit and should display invalid data
entry messages.

Requirements

• Develop IPO chart for each question.


• Programs should prompt the users to enter series of data including sentinel value to
terminate the program.
• Programs should display error messages (invalid data entry) and prompt the users to
enter the value again.
• Prepare a set of test data to document the logic testing and the output.
• Document whatever assumption made for program design.
• Design the output to display the Question no, Name of the program, Programmer’s
name and the necessary input and output messages.

Submission of Work
 The Question Number(s) should be the name of the C program(s).
 Save all the C program source codes in a CD.
 Print IPO chart, Test Data and assumption made for each question.
 Place the CD in a proper plastic CD cover and label it with the necessary details
[Name, Student ID, Programme and Group ]
 Print and fill in the Course submission and Assessment Criteria Forms [U:\All
Users\Foundation\Reginamary Matthews]
 Deposit your CD and Assessment Criteria Form (** labelled CD plastic cover) in an
envelope.
 Seal the Coursework Submission Form on the envelope.
 Submit your ENVELOPE to the Faculty of Science Office before the due date.

Page 2