Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java. Also please the whole screenshot of the classes. TY Project Description In this project you will build a car configuration application in six

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

In Java. Also please the whole screenshot of the classes. TY

Project Description In this project you will build a car configuration application in six units. Each unit provides learning opportunities in Object Oriented Design. You are expected to document these lessons and apply them in next unit. You will notice that the design guidance will taper off as you progress through units in Project 1. You will be expected to design on your own. Project 1 - Unit 1 In this project you will build a Car Configuration Application. In this unit you will develop a "reference" base object model, read a text file to build the reference base object model and archive it using Serialization. I would like you start with a proof of concept - so we will first build the underlying object using normal Java Classes and Inner Classes. For our proof of concept please consider the following requirements: We will build Ford's Focus Wagon ZTW model with these options: - Color - Fort Knox Gold Clearcoat Metallic, Liquid Grey Clearcoat Metallic, Infra-Red Clearcoat, Grabber Green Clearcoat Metallic, Sangria Red Clearcoat Metallic, French Blue Clearcoat Metallic, Twilight Blue Clearcoat Metallic, CD Silver Clearcoat Metallic, Pitch Black Clearcoat, Cloud 9 White Clearcoat - Transmission - automatic or manual - Brakes/Traction Control - Standard, ABS, or ABS with Advance Trac - Side Impact Air Bags - present or not present - Power Moonroof - present or not present Configuration options and cost data: Your Deliverable: Design and code classes for these requirements and write a driver program to instantiate a Ford Wagon ZTW object and write it to a file. Test your code with a couple of instances of Forward Wagon ZTW. Step 1 - Analysis 1. Analyze data and create a set of classes. 2. From the data provided in project description you can try to find patterns in structuring information. You will notice that: a. Each model (Ford Wagon ZTW) definition has a set of properties (Color, Transmission etc.) b. Each property has a set of values (For color there are different values like Fort Knox Gold Clearcoat Metallic etc.) c. Each property has a price. d. Model also has a price. e. Values for each property tend to be different in quantity. Step 2 - Designing Classes 1. Using the information in the last step (Analysis) you can start designing classes and how each might relate. 2. We will certainly not create classes for each property as that will not be reusable design. 3. We can create a Model class that can hold name of the model, base price and information about all the properties (Let's call it OptionSet) 4. Each OptionSet has a set of values. Each value can be defined in its own class (Let's call it Option). Each Option can have name and price as properties. 5. Each OptionSet will also have a name. Step 3 - Define Class relationships for class Model package 1. We can see that Model will contain OptionSet and Each OptionSet will contain Option class. 2. For practice and learning purposes be sure to make Option class an Inner class of OptionSet. 3. The structure at a high level might look like this: class Automotive \& //This class will represent the Model. String name; OptionSet opset[] ; Model(int size, String n ) \{ opset = new OptionSet[size]; name =n; class OptionSet \{ Option opt []; String name; OptionSet (String n, int size) \{ opt = new Option[size]; name =n; \} \} class Option String name; float price; \} 4. In the above code you will notice that Each model has a set of OptionSets. Each OptionSet has a set of Options. 5. For each Array object (opset and opt) you will need to instantiate objects to avoid NullPointerException. for(int i=0;i1 object use an array or a collection. TIP - How to write and read a serialized file? class A implements Serializable {} class B extends A {} class ObjectFileTest f public static void main(String[] args) 1 try \{ A [] staff = new A[3]; staff [0]= new A(); staff [1]= new B(); staff [2]= new A(); ObjectOutputStream out = new ObjectoutputStream(new FileoutputStream("A.dat")); out.writeobject (staff); out.close (); ObjectInputStream in = new ObjectInputStream(new FileInputStream("A. dat")); A[] newstaff =(A[l) in.readobject(); 1 catch (Exception e) \{ System.out.print ("Error: " +e); System.exit(1); 1 \} \} 8 - Test and Submit Use the following driver (or something similar) for testing entire project. class Driver \& public static void main(String [] args) \& //Build Automobile Object from a file. Automobile FordzTW = (Some instance method in a class of Util package).readFile ("FordzTW.txt"); //Print attributes before serialization tep 8 - Test and Submit 1. Use the following driver (or something similar) for testing entire project. class Driver f public static void main(String [] args) / //Build Automobile object from a file. Automobile FordzTW = (Some instance method in a class of Util package).readFile("FordzTW.txt"); //Print attributes before serialization FordzTW.print(); //Serialize the object Lab1.autoutil.FileIo.serializeAuto(FordzTW); //Deserialize the object and read it into memory. Automobile newFordzTW = Lab1.autoutil.FileIo.DeserializeAuto ("auto.ser"); //Print new attributes. newFordzTW. print()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions