project 2-Carpet center Bill Creator






The purpose of this lab project is to expose you to input, process, and output using functions. pass by value/ pass by reference and modular functions to generate headings, reports and footings.


Problem Specification:

You are working for the Passaic County Community Carpet Center.  Your boss has asked you to write and execute a program that will generate customers’ bills. Input consists of the following:


The Customer name (a string containing a blank)
The Customers id number  (an integer)
The Length and the Width of a room in feet and inches (Integers)
The carpet price per square foot (float)
The percentage of discount for each customer (float)
The labor cost is fixed at $1.65 / Sq foot, the tax rate is 7.0% and they are defined as constants.


A sample input to the program is as follows:

Customers’ Name          :  Adnan I. Atshan

Customers’ ID#             :  12345

Length of Room             :  Feet     :  30

:  Inches  : 5

Width of Room              :  Feet     :  18

:  Inches  : 11

Cost / Square Foot         :  18.23

Percentage of Discount : 9


Your program’s design should use the function main () and the sub-functions noted below:

getdata( ) a function that allows you to input the data from the keyboard (all variables are passed by reference so they may return their values to the calling function). The function itself returns the area of a carpet needed in square feet to cover the room. Note that every fraction of a square foot is a square foot.
calculations( ) this is a function that calls the following three functions.
·         Calculate the installed price calcinstalled( )  = cost of carpet + cost of labor

·         Calculate the subtotal calcsubtotal ( )  =  installed price – discount

·         Calculate the total price calctotal( )  = the subtotal + taxes

There may be intermediate calculations. It might also be possible to reuse a function, if it accomplishes the same task with different arguments.


showresult( )  is a function that calls three sub-functions
·         headings( )  the name of the company, customer’s name, borders …etc.

·         measurements( ) a subroutine to print the length, width and area.

·         Charges( ) prints the charges.


·         Comment thoroughly as you did in previous projects.

·         Following good structured programming practices, the steps of the programming process that I always talk about.

·         Create two constants.

·         Use functions as specified.

·         Calculate using the two constants you defined, and whatever values that was entered.

·         Output the report as listed below.


Output for Adnan I Atshan could be:


Passaic County Community Carpet Center

123 Main Street

Paterson, NJ  07505


Customer Name:                   Adnan I. Atshan

Customer Number:               12345


Room Measurements:

Length :    30’ 5”

Width  :    18’ 11”

Area    :    576            Sq/Ft




Description                     Cost/SQ Ft                 Charges/Room

—————                     —————                 ——————–

Carpet                                                $18.23                         $10500.48

Labor                                     $1.65                                $950.40


Installed Price                                                            $11450.88

Discount                                 9.00%                            $1030.58


Subtotal                                                                      $10420.20

Tax                                                                                $729.46


Total                                                                           $11149.66


Thank You for Using PCCCC as You Professional Carpet Store



Grading criteria:

10 points         Good programming practices: Proper spacing, comments, use of variables, indentation and appearance of program.

5 points         Descriptive names are used.

5 points         Constants are used.

10 points         Flowchart is handed-in and is correct (proper symbols, detailed)

10 points         Hierarchical chart is handed-in and is correct.

5 points         Input statement is used to enter data with prompts.

5 points         getdata() returns the area of a carpet needed in square feet to cover the room..

5 points         Pass by value is used, only variables that change are passed by reference.

5 points         output is aligned using modifiers.

5 points         Proper headings and titles are printed.

5 points         functions are not duplicated.

10 points         functions are properly used.

15 points         Program runs correctly and produces the intended results.

5 points           multiple test runs are submitted (programs’ output)


Submission Details:

Submit a print-out of:

·         The source files

·         Hierarchical chart

·         A flowchart/ pseudo-code of the Program

·         Multiple test runs.