Assignment 6 – Vehicle Inventory

Maximum Points = 50

 

 The purpose of this lab is to continue your introduction to user-defined classes and to the Scanner, File, and Frame classes in the Java programming language. In this assignment, you will write a program that reads data from two files and then displays the vehicle inventory.

.

v  Your program must read the data from two files called cars.txt and other.txt  NOTE: you will need to use the comma delimiter as illustrated in the examples to separate the data components.

v  The file will consist of data for five (5) cars/other vehicles (each vehicle will consist of a make, model, year, trim, price, exterior color, interior color) where each component will be separated by the comma (,) symbol as shown below. In addition, others have a field that identifies the vehicle as SUV, truck, or van.

 

cars.txt

Kia, Optima, 2012, EX, 23500, Red, Dark Gray

Ford, Focus, 2013, SE, 20090, Cyan, Black

            :

 

            others.txt

            Kia, Sportage, SUV, 2013, EX, 24200, Green, Black

Ford, F-150, truck, 2013, Limited, 53498, Red, Black

 ------------------------------------------------------------------------------------------------------------------------------

Sample swatches:

             http://www.oslopress.com/images/options/op-color-swatches.gif                                                     

 

v  Your program must include a parent class that will hold vehicle data (complete with constructor(s), get and set methods for each instance variable, and a toString method that returns the contents of the instance variables) and two subclasses for cars and other vehicles with the appropriate constructors, get, set and toString methods where needed.

v  Include an additional method drawSwatch (see page 113 of Big Java) that receives the x and y coordinates of the top corner of the interior/exterior colors and draws the swatch at the specified location (assume all three stripes are the same “width”).

v  Once your program has collected the data from the files, you need to ask the users which type of vehicles (cars or others) to display and then display the five vehicles of the specified type on the same screen using a JFrame.

v  Your listing should have an appropriate title at the top in a larger font (and different font face and color). The listing of the five vehicles should display the information about the vehicle and color swatches for each vehicle.

v  Print the total value of the inventory displayed.

v  Modularize your program to minimize the amount of changes you would need to make if we change the number of vehicles.

 


EXTRA CHALLENGES:                

i) add additional types of vehicles

ii) create color swatches for colors not built into Java.

iii) add images

http://static.hgmsites.net/images/cache/2013-ford-edge-4-door-se-fwd-angular-front-exterior-view_100387637_100x60.jpg

 

 

Make sure that your program uses proper indentation and complete documentation. See http://csc.columbusstate.edu/summers/NOTES/1301/style.htm for guidelines.

The program heading should occur at the top of the program and should include:

               /**
                * PROGRAM SPECIFICATIONS
                * NARRATIVE DESCRIPTION:
                *
                * @author (your name) 
                * @version (date)
                */

 

  (Due before 8 a.m. on Wednesday, October 24, 2012) Submit a .doc file containing the UML class diagrams (including the “main” class) showing inheritance for all the classes used in your program and your timesheet documenting your time so far to the dropbox in WebCT. [10 pts]

(Due before 8 a.m. on Wednesday, October 31, 2012) Submit your .java files containing your program and your timesheet documenting your time to the dropbox in WebCT.

 Grades are determined using the following scale:

  Header..………………….:___/2

  Data members……..……:___/4

  Methods..………………..:___/4

 

  • Runs correctly..…………………:___/10
  • Correct output……..……………:___/10
  • Design of output..………………:___/8
  • Design of logic…………………:___/10
  • Standards……………………….:___/7
  • Documentation.………………...:___/5

 

Grading Rubric  (Word document)