Due Date: Friday, Sept 19, 8:30 AM
BackgroundAlfred, a poor and starving grad student, thinks he can support himself better by taking up professional golf. We are going to write a program to help Alfred decide which life, if either, will make him rich. Each tournament that Alfred plays costs him $3,500 to enter (counting travel, equipments, fees, etc). Obviously, the better Alfred plays at each tournament, the more money he is likely to win. We will use the old golfing principle: Drive for show, putt for dough. Each time Alfred makes a one-putt, he wins $2,300.45. However, every time he hits the ball out of bounds, he looses $5,999.99.Program requirementsYou will write a program that does the following in this order:
Hints and suggestions
Example operationThings the user types are in bold.How many one-putts does Alfred make: 5 How many times does he hit out of bounds: 1 Alfred makes, on average, $2002.26 per tournament. How many tournaments for the season: 21 In one season, Alfred will make 42047.46 dollars. Commenting Your Program:Comments are required for this and all subsequent programs. They are used to document your program, but are ignored by the compiler. As you develop your program, comments are added for clarification and explanation. In C++ comments follow after // and continue only to the end of the line. You may also use C comments, which are between /* and */ and can span several lines. Comments are found...
Testing SuggestionsMake sure that you have thoroughly tested your program before turning it in. Try your program out with lots of different sample input data. Check your program's results by using a calculator to compute the formula yourself. Your program will probably crash if the user types in "0" for some of the values; you do not need to prevent this from happening, but this is a known bug that you should mention in a comment at the beginning of the program. Explain for which values the user cannot enter "0" and why the program crashes if they do.What to turn inI suggest that you call your Visual C++ Workspace program1 and that you call your CPP file golf.cpp. Use the same hand-in procedure as for program 0. Electronically submit two files:
Please do not turn in more than those two files. Remember, your handin directory is P:\course\cs302\colbster\YOURNAME\prog1. Your personal files should be located in U:\private. Drag the files from the U drive to the P drive. When you are done, the P drive should have two files, golf.cpp and program1.exe. In general, you can always look at your past programs for reference. After I am finished grading a program, I will make it readable for you to look at on the P drive. Or you can just look at your copy on the U drive. You must turn in your program on time! Late programs will not be accepted, and will receive a zero. It's better to turn in something, than nothing. Remember, start early. Utilize my office hours or the consultants in the lab if you need help. Good luck! |