Project Three due Fri 12 Oct, 1PM

MCS 260 Project Three : Boat Rentals, due Friday 12 October 2001, at 1PM.

The purpose of the project is to manage the renting of boats.

For this project we distinguish types of boats according to the number of persons the boat can carry. Assume our company offers three types of boats: for 1, 2, and 3 persons. The task of the program is to help the client selecting a boat and to keep track of the number of available boats of each type.

Initially (i.e., only once at the start of the program), the user is asked to type in the number of boats of each type. Then the following menu is presented :

       0. terminate the program;
       1. see the number of available boats of each type;
       2. rent a boat, of a type that is available;
       3. return a boat.
If the user types in a number outside the range 0..3 when selecting from the menu, the message "Invalid option. Please Try again." should be displayed, giving the user the opportunity to start over again. You may expect that only integer numbers will be entered, so you should not place guards for alphanumeric input.

When no boats of the requested type are available for renting, the user should receive a message, whereafter the main menu is shown again. The same type of message should be received when a boat of the wrong type is returned. When renting or returning available boats, the client receives an acknowledgement. For an example of such a confirmation, see the sample session below :

jan@galois]% ./boats

Welcome to our boat rental company!
  Give number of 1-person boats : 2
  Give number of 2-person boats : 1
  Give number of 3-person boats : 4

Choose one of the following:
  0. terminate the program;
  1. see the number of available boats of each type;
  2. rent a boat, of a type that is available;
  3. return a boat.
Type 0,1,2, or 3 to select : 2

For how many persons ? 2
Thank you for using our 2-person boat.

Choose one of the following:
  0. terminate the program;
  1. see the number of available boats of each type;
  2. rent a boat, of a type that is available;
  3. return a boat.
Type 0,1,2, or 3 to select : 1

Number of 1-person boats available : 2
Number of 2-person boats available : 0
Number of 3-person boats available : 4

Choose one of the following:
  0. terminate the program;
  1. see the number of available boats of each type;
  2. rent a boat, of a type that is available;
  3. return a boat.
Type 0,1,2, or 3 to select : 2

For how many persons ? 2
Sorry, no 2-person boat available.

Choose one of the following:
  0. terminate the program;
  1. see the number of available boats of each type;
  2. rent a boat, of a type that is available;
  3. return a boat.
Type 0,1,2, or 3 to select : 3

For how many persons ? 4
Sorry, no 4-person boat available.

Choose one of the following:
  0. terminate the program;
  1. see the number of available boats of each type;
  2. rent a boat, of a type that is available;
  3. return a boat.
Type 0,1,2, or 3 to select : 1

Number of 1-person boats available : 2
Number of 2-person boats available : 0
Number of 3-person boats available : 4

Choose one of the following:
  0. terminate the program;
  1. see the number of available boats of each type;
  2. rent a boat, of a type that is available;
  3. return a boat.
Type 0,1,2, or 3 to select : 3

For how many persons ? 1

Choose one of the following:
  0. terminate the program;
  1. see the number of available boats of each type;
  2. rent a boat, of a type that is available;
  3. return a boat.
Type 0,1,2, or 3 to select : 1

Number of 1-person boats available : 3
Number of 2-person boats available : 0
Number of 3-person boats available : 4

Choose one of the following:
  0. terminate the program;
  1. see the number of available boats of each type;
  2. rent a boat, of a type that is available;
  3. return a boat.
Type 0,1,2, or 3 to select : 0
[jan@galois]%
You must use functions to implement this project. Correct solutions that do not use functions will be worth 30 points out of the total of 40.

Mind spelling mistakes in the dialogue with the user and the output.

The first line of your program should be like

                     /* MCS 260 Project Three by <Author> */
where you replace the <Author> by your name.

The gcc compiler will be used to test your program. So even if you have developed your program in a Windows environment, test your code on icarus.cc.uic.edu with gcc. To ensure your program is written in ANSI C, compile with the option -ansi, e.g., like

                     gcc -ansi proj3.c
Programs that are not conform the ANSI C standard will be discounted.

The printout of your program will be collected at the start of the lecture on Friday 12 October, at 1PM. Before the deadline, send the code by e-mail to janv@uic.edu from your account on icarus. If you saved your program in the file proj3.c, then you send your program typing on icarus the following command :

                     mail janv@uic.edu < proj3.c
This ensures your program is free from any encapsulations. Note that the e-mail address is my university netid and not the address at the MSCS department.

If you have questions, comments, or difficulties, feel free to come to my office for help.