LAB4                          Car Buying PROJECT                    CSE314 Spring 2005

Assigned

  • T 5/3

Due

  • R 5/12 by midnight

Goals

  • Selection statements
  • Single Control Break Algorithm

FYI

  • be sure to comment the program, with author name, due date and the purpose of the program in the identification division; be sure to comment each paragraph in the procedure division as well. 
  • as mentioned in class, comments should be what you are doing, not how (think business description, not technical!)
  • be careful how large you  make your memory locations when creating calculated data fields; you need to make sure you make them large enough!
  • assume the data is given correctly in the input file.

Project Information

PROBLEM:   Write a program, called lab4.cob using file I/O to output the input information in report format.   The input file can be accessed or copied from the following location:  /usr/class/cis314/sp05/lab4carin.dat.  You will have a second input file which you will create yourself as explained below.

Ø      You may have multiple records for the same car because some of the data may be different… for example, color, dealership, or cost for the same make/model.

Ø      Before submitting your lab, you MUST be sure to list the entire input file location given above on your select statement.  Points will be deducted if you forget since the program will not be able to find the input file!

Ø      You do not know the number of records in the car input file, so you must check for end of file.

 

INPUT FILE RECORD LAYOUT for lab2buyerin.dat

You have already created this file.

§         Your name – you determine the length and type

§         The date you need the car by – numeric length 6

§         The maximum amount you are willing to spend on a car – integer type; you determine the length!

 

INPUT FILE RECORD LAYOUT for lab4carin.dat

It is possible that the data in this file will change, so don’t base your program on the exact data values.  However, the format (i.e. types and lengths) of each field will stay exactly the same.  Also, the data in this file will be grouped by the TYPE field so that the single control break algorithm can be used.  Remember, though, that the order of the groups will be variable i.e. the order of the groups of data can change and your program should still work!

 

§         Dealership – alphanumeric length 12 (ex. Tansky)

§         Make – alphanumeric length 10 (ex. Toyota)

§         Model – alphanumeric length 10 (ex. Sienna)

§         Type – values include truck, car, van, sport, suv – alphabetic length 5

§         Color – alphanumeric length 10

§         Safety Rating – numeric length 1

§         Reliability Rating – numeric length 1

§         Cost – numeric (integer) length 6

§         Name of sales rep – alphanumeric length 15

 


OUTPUT FILE LAYOUT

 

The output file report should look similar to the following with the name lab4out.dat (again, be sure to use this name so the grader doesn’t have to look up the name of the output file when grading).  Be sure to copy the way the sample report is indented, centered in places, and has blank lines - it helps with the readability of the report!  

 

Sample Output Report:

(no blank line here!)

current date: mm/dd/yyyy                                                 current time:  HH:MM:SS

            *** blank line

Name:  your name here from the lab2buyerin.dat file

Date car needed:  mm/dd/yy format from the lab2buyerin.dat file

Maximum Car Cost:  from the lab2buyerin.dat file

         ***blank line                                 

                           PAGE HEADING TO DESCRIBE THIS REPORT

         ***blank line

TYPE: value (whatever the first car type group is as represented in the input file)

            Dealership      Sales Rep    Make      Model        Color     Cost     SR     RR

            ***blank line

            è individual car data goes here!  one line per car; no blank lines in between

            ***blank line

            TOTALS:  

            Total number of group options:         integer value

            Average car cost:                            real value; edited with $ and , to two decimal places

            Average Safety Rating:                    real value; edited with $ and , to two decimal places

            Average Reliability Rating:               real value; edited with $ and , to two decimal places

            *** blank line

***Repeat the TYPE section for each group of data

SUMMARY INFORMATION

Total number of car options:    integer value

Average car cost:                   real value; edited with $ and , to two decimal places

Average Safety Rating:           real value; edited with $ and , to two decimal places

Average Reliability Rating:      real value; edited with $ and , to two decimal places

         ***blank line

END OF REPORT

 

Output File Description:

Ø      Be sure to include the blank lines as shown above

Ø      The current date should be left justified and the current time should be right justified on the first line of the output file over the PAGE HEADING discussed below.  The format seen here is exactly what you should have in your output file (labels, entire year of length 4, colons between hours and minutes, and minutes and seconds, etc)

Ø      Create your own PAGE HEADING line to describe the report.  It needs to be centered over the group and column headers.

Ø      Column headers need to be underlined INDIVIDUALLY.  If you have more than one column heading line, the underline should only be on the part of the header that is the “bottom” of the column description.  You can underline the entire length of the column field, if you like (different from above), but you CANNOT underline the blank spaces in between each column header field! 

Ø      The car data should all line up nicely under the column headers. 

Ø      The data should be edited whenever possible!

Ø      The last line in the output file should be the “END OF REPORT” line

External Documentation

Discussed in class; there is no external documentation required for this lab.

Submitting Project Files

When you are finished with the lab, submit the following files for grading:

  • Lab4.cob
  • lab2buyerin.dat

 

See Lab1 for information on how to use a submit command.  Also, note that programs must be submitted in source code form. For example, if you submit "lab2.acu" instead of "lab2.cob", you will have, at a minimum, points deducted equivalent to submitting a day late (20%).

Deleting Unnecessary Files

See Lab1 for information about deleting unnecessary files.