Project #3

advertisement
BACS 387
3/24/2016 12:17:09 PM
387Project3.docx
C# Project #3
Date Due: 11/5/12
The purpose of this project is to familiarize you with functions, parameter passing, iteration
statements and basic data validation in C#. Your goal is to create a working project that satisfies
the problem described below. For full credit, make sure that your code produces the correct
answers, uses good C# coding style, and is properly commented. This is an individual
assignment. Please start early and ask questions if you need help. Good Luck.
Deliverables:
You will turn in the following:
 A printout of the code. Make sure that code lines wrap (that is, I need to be able to
see the entire code line).
 A design document (either pseudocode or flowchart) describing your program logic.
 The sub-directories that include the project files for your program on a removable
media. For full credit, your project must run from the executable file on your disk.
There is an automatic 10 point deduction (minimum) if I have to open the C# project
files and modify your program to make it run.
The Problem: Paint Job Estimator
Write a console program to calculate the total cost of a painting job. The painting company has
determined that it takes one gallon of paint to cover 104 square feet of wall space. They also
know that it takes 4 hours of labor (at $20.50 per hour) to use one gallon of paint. Your program
should ask the user to enter the number of rooms to be painted and the price per gallon for paint.
For each room, your program should ask for the square feet of wall space to be painted. (Be sure
to leave the cursor at the end of the query line for all questions in this program.) Your program
should then use 5 methods (i.e., functions) to calculate the following:





The number of gallons of paint required for the full job
The hours of labor required for the job
The total cost of paint to be used
The total labor charges
The total cost of the paint job (i.e., paint plus labor)
Your program should display all the data on the screen in a pleasing, professional manner
(include proper currency formatting). For full credit, the methods must use parameters that are
passed to them (that is, do not use public variables to bypass parameter passing) and return
values. Also, you need to use constants where appropriate (e.g., hourly wage, coverage per
gallon, …). Finally, your program should validate the data to make sure that the cost per gallon
is greater than $0 and less than $100, the number of rooms is at least 1 and not greater than 25,
and the square footage for each room is greater than 0 and less than 15,000. In addition, you
should “gracefully handle” any exceptions where non-numeric data is entered. All exception
handling should include appropriate error messages and then the query should be repeated (that
is, the program should not abort if bad data are entered.)
BACS 387 – Dr. Lightfoot
1
387Project3.docx
Download