The program should prompt the user for the input data. When the input of an item has been completed, a prompt for additional items for entry should be posted.

computer science

Description

 

                  

                   Midterm Exam

                      

 

 


Purpose

 

You are to create a program which allows the user to enter data for Noah’s Ark, a company which boards animals.  The input to the program contains a list of animals currently boarded, including the tracking number of the animal, the type of animal boarded, and the daily boarding charge for the animal.  After the data entry is complete, the items entered are stored in a linked list and printed to the monitor.

 

Program Input

 

The input to the program will be the tracking number of the animal, the type of animal boarded, and the daily boarding charge for the animal.

 

The following input should be used to test your program:

 

  Tracking                      Type of Animal                             Daily Boarding

   Number                                                                                     Charge

   10001           Black and Tan Miniature Dachshund                     75.50

   20001           Siamese Cat                                                            50.00

   30001           Shetland Pony                                                       250.75

   40001           Tortoise                                                                   15.00

   50001           Chocolate Ranchu                                                     4.75

 

The program should prompt the user for the input data.  When the input of an item has been completed, a prompt for additional items for entry should be posted.  If the user chooses to enter additional items, the prompts for input data should appear once again.  If the user chooses to end the data entry, the program should display the items entered (no sorting of the data is required).


 

Output

 

·         Prepare a listing of the animals with appropriate column headings.  Align the data neatly within columns.  This listing should include the following:

 

ü  the tracking number of the animal;

ü  the type of animal boarded;

ü  the daily boarding charge for the animal (formatted to two decimal places).

 

Processing

 

1.   You must use a structure which includes the following elements:

 

a.   the tracking number of the animal                                    integer

b.   the type of animal boarded                                               character array

c.   the daily boarding charge for the animal                          double

d.   pointer to next record                                                       pointer

 

2.   One global variable may be used.  This variable should represent a pointer to the head of the linked list.

 

3.   Two functions should be included to perform the following:

 

a.       insert an item into a linked list;

b.      display the values of all of the members of the list to the monitor (as described in the “output” section);

 

4.   Create a program that prompts the user to enter the required data (as described in the “input” section).  Once the data has been entered for an item, the appropriate function should be called to insert the item at the head position of a linked list.  The prompts for data should be placed inside a “while” loop which asks the user for additional items to be entered.  Once the data entry is completed, the appropriate function should be called to display the data in a formatted manner to the monitor.

 

Program Submission Requirements

 

  • 2 attachments:  a copy of the project folder saved with your Last Name .

 

ü  Screen capture and code in a word document.

ü  Please answer the following questions in the comments section of submission:

§  Did your program have any syntax errors?  Y/N

§  Did your program run and produce an output? Y/N

§  Any other comments: 


Related Questions in computer science category