Topical Information

This program will help you demonstrate your mastery of branching and looping while giving you a chance to improve your mastery of function design.

Program Information

Fred's Gas'n'Go has just installed a car wash. They'd like the customers to be able to purchase a wash at the pump just like at the fancy stations. Fred's idea is very similar to that at your average Mobil™ or Shell™:

    +--->   Car wash?  --No-----+--->
    |         |                 |
    |        Yes                |
    |         |                 |
    |        \ /                |
    |         `                 |
    |      Super, Premium,      |
    |        or Ultra?          |
    |         |                 |
    |         |                 |
    |        \ /                |
    |         `                 |
    |       display price;      |
    +--No-- Price okay?         |
              |                 |
             Yes                |
              |                 |
             \ /                |
              `                 |
            print wash code ----+

The price for a Super wash is $5.00. A Premium wash is $6.00. And an Ultra wash is $8.00. These prices are subject to materials and maintenance costs, of course, and might have to be changed. (Hint: Making them a global constant would make them easily found and changed when the need arises!)

The user's choice of wash should be by the first letter of the wash name: S, P, or U. (Allow them to enter it by upper or lower case, of course...)

Use functions to break the problem into manageable pieces. Try to make your functions general/re-usable so you can get more mileage...er...use out of them later.


As an example, you might have the program interaction look something like (the parts in this style are typed by the user):

$ ./carwash.out

                 Welcome to Fred's Gas'n'Go Car Wash System!!!

Would you like a car wash today?  you becha!

Which wash would you like:  Super, Premium, or Ultra?  super...man

That will be $5.00, is that okay?  no way!  es muy dinero!

I'm sorry...


Would you like a car wash today?  YES!!!

Which wash would you like:  Super, Premium, or Ultra?  Ultra...man

That will be $8.00, is that okay?  No can do, kemo slabe...

I'm sorry...


Would you like a car wash today?  yuh...but I'm losing hope...

Which wash would you like:  Super, Premium, or Ultra?  premioso por favor

That will be $6.00, is that okay?  yeah...let me take out a loan first...


Good, your wash code is 5783210.  It will be good until noon on Friday.


Thank you for using the FGnGCWS!!

Endeavor to have a spot-free day!

$

Note how the user is allowed to enter whole words (or even phrases) instead of just the first characters of responses: yes instead of just y, ultra instead of just u, etc. (This should use nothing beyond basic input!) Note that you don't actually need the whole word to process their choice...but letting them enter it will make them feel better...

Don't worry about filling in the code and the time: that's another team member's job (see the options; *wink*). You can simply print the same thing all the time until you get their code to meld in to yours.

Be sure to look for any helpful resources you can in the notes on programming with ctime's time() function. You can never tell when something might come in handy!

This assignment is (Level 4).

Options


Total Level Possible

If you did all above options, this project could be worth as much as (Level 14.5).