Sunteți pe pagina 1din 2

Course: Programming Fundamentals

Assignment 5 Functions: Reference Parameters, Void functions


Date: 11th May, 2013 Question 1: A new firm has been setup in the city, which sells wooden panels. The firm provides to the customers with services to repair and tile the walls. You are asked to write a program for the firm to print Bills for the customers. The bills include the detail of total cost of tiling the walls. Input to program is the measurements of the room i.e. length and width of the wall of the room to be tiled. The bill is then calculated based on following details. The wooden panels come in two sizes in width i.e. one-foot panel and 3-inches panel. The length/height of the panels can be of any size, according to the height of the wall. Number of one-foot and 3-inches panel required to cover the wall depends on the width of the wall. Width of the wall is measured in feet and inches. Height of wall is measured in feet (assuming that measurements do not include fractions). Some part of the wall may be left uncovered if it is less than 3 inches in width. Cost of the panels depends on the length/height of the panel. One-foot panel costs 10 Rs. per feet, and 3-inches panel costs 5 Rs. per feet. Course Instructors: Ms. Hafsah Qaiser

To write the program, you need to implement following functions.

Function to take input: This function takes input for height of the room and width of the two walls. You need to use reference parameters in this function and it will be a void function.
void input (int & feet_wall, int & inches_wall, int & lenght)

Function to calculate number of one-foot and 3-inches panels required for the room: As this function calculates more than one value, you need to implement this function using reference parameters.
void NumberOfPannels (int feet_wall, int inches_wall, int length, int & numberofOne_footPanel, int & numberof3-inchesPanel )

Function to calculate the total cost. This function also needs reference parameters, as the cost of two types of are required to be calculated separately, which are later required in other function.
void Cost (int numberofOne_footPanel, int numberof3-inchesPanel, int length, int & costOfOneFootPanel, int & costOf3-inchesPanel )

Function to print the Bill. This will be a void function which needs not to return any value. The function should print the bill in following format.

BILL: Height of wall: Width of wall: Feet: Inches: No of one-foot panels required: No of 3-inches panels requires: Length of panels: Cost of one-foot panels: Cost of 3-inches panels: Total Cost:

8 feet 12 feet 8 inches 12 panels 2 panels 8 feet 960 Rs. 80 Rs. 1040 Rs.

The main function should not contain any functionality. It should consist of series of function calls. Instructions: o Deadline to submit the assignment is 20th May till midnight. o No late submission will be accepted. o Email the assignment at cprog13@gmail.com. Do not email in any other id, it will not be considered then. File name must be your name and email subject must be Assignment_5 (Your name). [Guidelines must be followed strictly] o Plagiarism and copy will be dealt strictly.
======================= Best of Luck

S-ar putea să vă placă și