programming mini projectcsc430

8
MINI PROJECT (GROUP: 4-5 PERSONS/GROUP) CSC430 What you should have in the project? Analysis of the problem should be clarified. Implementation (coding) - the effectiveness and the efficiency of the program will be considered - print out the source code Sample of input/output Brief biodata (include your picture) about members in the group. Cover page of the mini project. Bind together all the items needed for the mini project. Hand in your report and also the softcopy of your project (CD). Dateline: 26/06/2012 (EMD2M4A) Dateline: 27/06/2012 (EMD2M1A) Note: mark will be given based on the above requirement Marks will be deducted if your answers same with the other groups!!! Contact number: 013-9990890 (HP), 03-5521 1183 (Office) FACULTY OF COMPUTER SCIENCES & MATHEMATICS (ROOM: T1-04 CS2)

Upload: nik-syukriah-amin

Post on 05-Jan-2016

4 views

Category:

Documents


1 download

DESCRIPTION

Programming Mini ProjectCSC430

TRANSCRIPT

Page 1: Programming Mini ProjectCSC430

MINI PROJECT (GROUP: 4-5 PERSONS/GROUP)CSC430

What you should have in the project?

Analysis of the problem should be clarified.

Implementation (coding)

- the effectiveness and the efficiency of the program will be considered- print out the source code

Sample of input/output

Brief biodata (include your picture) about members in the group.

Cover page of the mini project.

Bind together all the items needed for the mini project.

Hand in your report and also the softcopy of your project (CD).

Dateline: 26/06/2012 (EMD2M4A)

Dateline: 27/06/2012 (EMD2M1A)

Note: mark will be given based on the above requirement

Marks will be deducted if your answers same with the other groups!!!

Contact number: 013-9990890 (HP), 03-5521 1183 (Office)FACULTY OF COMPUTER SCIENCES & MATHEMATICS (ROOM: T1-04 CS2)

QUESTION 1

Page 2: Programming Mini ProjectCSC430

A businessman has 3 maids, 2 gardeners and 2 drivers. Write a program that can prepare a paid slip for every worker.In the program, the data for each worker are as follows:Personnel ID, KWSP number, Name, Position, and Salary.

Position are entered based on job as below:1 – maid 2- gardener 3- driver

Example of input:

Enter month: 10 Enter year: 2012

Personnel ID: 1104Name: NursyahidaKWSP number: 10312478Position: 1Salary: 445.67

Personnel ID: 0509Name: AzriKWSP number: 12345678Position: 2Salary: 395.90

(continue entering the data for all workers)

KWSP deduction : 9% from salary

The output should be as below:

Name: Nursyahida Personnel ID : 1104Month: October 2012 KWSP number: 10312478Position: Maid-----------------------------------------------------------------------------------------------------------------

Salary : RM 445.67KWSP deduction : RM 40.11Net Salary : RM 405.56

*****************************************************************************************************Name: Azri Personnel ID : 0509Month: October 2012 KWSP number: 12345678Position: Gardener-----------------------------------------------------------------------------------------------------------------

Salary : RM 395.90KWSP deduction : RM 35.63Net Salary : RM 360.27

Page 3: Programming Mini ProjectCSC430

QUESTION 2

You are required to write a complete program that calculates the amount of water used for a month that has been imposed by Jabatan Bekalan Air Malaysia. The program should calculate the charges based on the following information:

i. Total payment overdueii. Past meter readingiii. Current meter reading

Given the charge rate as follows:

0 – 15 m3 : RM0.82 every m3

15.1 – 40 m3 : RM0.65 every m3

40.1 m3 and above : RM0.42 every m3

The minimum charge is RM5.00. Although the amount of water usage for any customer is less than RM5.00 the customer will be charged this minimum amount in their bills. Your program should be able to print the charges for that month and the overall total charges for each customer. Lastly, your program should display a report regarding the number of customers served and total collection of that particular day. Below is an output sample as a reference.

Page 4: Programming Mini ProjectCSC430

Sample of output:

Enter total payment overdue: 0Enter past meter reading: 2452Enter current meter reading: 2455

CURRENT CHARGE: RM 2.46OVERDUE CHARGE: RM 0.00TOTAL CHARGE : RM 5.00

Next customer? (y/n): yEnter total payment overdue: 8.0Enter past meter reading: 1456Enter current meter reading: 1890

CURRENT CHARGE: RM 182.28OVERDUE CHARGE: RM 8.00TOTAL CHARGE : RM 190.28

Next customer? (y/n): yEnter total payment overdue: 0Enter past meter reading: 2345Enter current meter reading: 2567

CURRENT CHARGE: RM 93.24OVERDUE CHARGE: RM 0.00TOTAL CHARGE : RM 93.24

Next customer? (y/n): n

*******REPORT SUMMARY*******NO OF CUSTOMERS: 3TOTAL COLLECTION: RM288.52

Page 5: Programming Mini ProjectCSC430

QUESTION 3

The Bahagia Hospital is introducing the new ward rates for year 2012:

Type of ward Government Servant (RM)Non government servant

(RM)

Class 1 90 120Class 2 70 90Class 3 50 70

Write a complete C++ program that performs the following:

a. Prompts and reads the input data below:• Patient's age• The type of ward (1, 2, or 3)• The patient's category ('G' for government servant or 'N' for non

government servant)• The number of days patient stay in the ward

b. Calculates the ward charges for a patient aged above 50 years. A patient who is above 50 years will only be charged RM 15 per day. A pensioner who was a government servant and aged above 55 years will only be charged RM 5 per day.

c. Calculates the ward charges for a patient aged 50 years and below. A patient aged 50 years and below will be charged according to the ward rates as given in the above table. The ward charges are the ward rates multiply by the number of days.

d. Prints the type of ward, patient's category and the ward charges.

Page 6: Programming Mini ProjectCSC430

QUESTION 4

Given the following C++ main() function of a program:

const float pie = 3.142;

main(){

float radius;char select;

cout << ”Enter the radius of a circle ”;cin >> radius;

cout << ”\nMenu”;cout << ”\nA – calculate the area of a circle “;cout << ”\nD – calculate the diameter of a circle”;cout << ”\nYour selection: “;cin >> select;

printAreaDiameter (select, radius);

return 0;

}

Write the function definition for printAreaDiameter() that calculates and displays either area or diameter of a circle. Display an appropriate message if the selection that has been passed to function is not A or D.Then, write the full program includes the main and function definition.

Page 7: Programming Mini ProjectCSC430

QUESTION 5

You have been hired to work in a new private college. On your second week there, you are instructed by the principal to write a full program that will enable the lecturers to key in the students’ marks. In the college each class is only limited to 20 students. The lecturers should be able to key in the students marks into an array named MARKS (example of marks input are: 89, 95, 72, 73, 99, 73, 86, 75, 92, 73, 79, 75, 50, 73).

As each mark is input, add the marks to total and determine the maximum andminimum mark. After all marks are input and the total is obtained, calculate theaverage of the marks .