Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please solve it as soon as and solve Bonus solve in Java . . . FINAL PROJECT : (YOU CAN USE ALL CONCEPTS YOU LEARNED

please solve it as soon as and solve Bonus solve in Java

image text in transcribed

.

image text in transcribed

.

image text in transcribed

.

FINAL PROJECT : (YOU CAN USE ALL CONCEPTS YOU LEARNED IN THIS COURSE) Objectives: In this assignment, you will apply the following concepts you learned in java (abstract class, interfaces, Polymorphism, exception handling, Files manipulation and encapsulation). Palestinian Vehicle Agency: A vehicle of three types (car, minivan, and truck) has many attributes. [Question] Designing Vehicle class and Its Sub-classes There are several Vehicles for transportation such as Car, Minivan, and Truck. Details of the classes for the vehicles are shown in the Figure1 > > Cloneable Comparable Owner Comapre To(Obj): int abstract class Vehicles Name:String #modelName:String PIN:String Address:String #ModelNo:String #Brand:String #engine Type:String MobileNO:String Petroleum Type 1 Date OBirth: Date +DIESEL:int #tunk Size:double +GASOLINE. getAge(: double #Fuel consumption:double gasolinePrice:double toString +Owner -diesel Price:double + abstract costFor 100Km) +getDiesel Price().double +Movable-distance) + abstract setAir Condition ONO +getDiesel Price():double +Set GasolinePricedouble) +set Diesel Price (double) + abstract setAirCondition of 4 Car Truck -NumberOfSeats:int Minivan - airCondistionON: Boolean power.int -NumberOfSeats:int -airCondistionON:Boolean -NumberOfSeats:int -airCondistionON: Boolean +toString +setAir ConditionON_Off():Boolean +costFor 100Km(Petroleum Type) - hasAutoDoors:Boolean setAir ConditionON_Oft():Boolean costFor 100Km(Petroleum Type) + setPower) +setNumberOfseats) +toString +toString +setAir ConditionON_Off():Boolean +costFor 100Km(Petroleum Type) setNumberOfseats) +setNumberOfseats) +setHasAutoDoors() 1 Request of the question: Write Java program code to realize the Figure .1 Description of the fields and methods of the classes as follows: 1. For Fields Model-name: Model name of a vehicle Brand: Company to produce the model Owner: Owner of the vehicle (as object) Engine-type: Type of the engine. Classified by fuel type to be used such as gasoline, diesel, or hybrid Tank-size: Size of fuel tank. Unit is liter. Fuel consumption: Fuel consumption. Unit is km/liter. numberOfSeats: Integer number of seats in a vehicle. airConditionOn: Boolean status of air-condition's working: ON/OFF. hasAutoDoor: Boolean status of a vehicle's having auto door. power: Horse Power of a vehicle's engine. Diesel is public static final int=1, and gasoline is public static final int=2 2. For Methods . Movable-distance(): Getting information of movable distance of a vehicle when the tank of the vehicle is filled fully. costFor 100Km(Petroleum-Price): Calculating cost for running 100Kms with the engine type and the petroleum type passed by as parameter. It will be different according to fuel and air-condition's status. setAirCondition ON: Setting the air-condition of the vehicle to ON. You can guess other methods. You have to add your owns methods, at least one additional method for each class, other than mentioned above. Create appropriate setters and getters for classes. . 3. Some conditions to write methods . The Car uses only gasoline engine. The Minivan can use engine of both gasoline and diesel. But the fuel consumption is same for both gasoline and diesel. The Truck uses only diesel engine. The engine type Hybrid uses only gasoline. Default air-condition status is OFF, and the air-condition can be ON/OFF after instances being created by setAirConON/setAirConOFF methods. Default fuel consumption is considered when air-condition is OFF. Fuel consumption of the Car increased by 10% when air-condition of the Car is ON. Fuel consumption of the Minivan and the Truck increased by 20% when air-condition of the Car is ON. For Petroleum Price: Gasoline get price from console NIS/liter, for instance 5.23 Nis/liter)), Dieselget price from console NIS/liter, for instance 4.02 NIS/liter) Use Exception Handling to handle errors caused by mismatch filling type of Petroleum, throw an illegal argument exception Date: you have to use Calender class (Gregorian calender). Use StringBuilder class to deal with string manipulations when read from file. (splitting, uppercase, lowercase,....etc) . Appropriately implement the above hierarchy and stick to the following All Vehicle objects are comparable based on the costFor100km. Clone an instance of Vehicle object, without cloning the owner of this Vehicle (set the owner to null for cloned object) Using deep cloning.toString() method should be implemented in appropriate way in all Vehicle sub classes displaying all the information including the costFor 100Km. 2 Create a menu that allow user to select from them as the following: 1. Read the data about objects from the file "inputdata.txt" and store them in Arraylist. 2. Set prices of petroleum. 3. Print sorted order Vehicles in an ascending order based on costFor 100Km. 4. (Bonus ) Print sorted order Vehicles in an ascending order based on owner name. 5. (Bonus ) Print sorted order Vehicles in an descending order based on vehicle brand. 6. Clone Vehicle without owner. (Ask user to choice one object for cloning from Arraylist, after Listing them to user) 7. Turn air-condition on 8. Write Output on the "output.txt" file after sort them. 9. Exit from System Note: when turn air-condition is on, you can again select one of steps 3-6, the output should be print on file. The file input format is: Car, Camley, E100, Toyota, Ahmad, Gasoline, 70.0, 15. 15,5 Car, Aqua, ES500, Toyota, Nader, Hybrid, 36.0, 40.0, 5 MiniVan, Sienna, A4, Toyota, Malik, Gasoline, 75. 0,9. 0,8, true Mini Van, Odyssey, S500, Honda, Khaled, Diesel, 56.0, 11.0, 8, false MiniVan, Presage, BX5000, Nissan, Shaher, Gasoline, 60.0, 7.0, 7, false Truck, Tundra, EDGE500, Toyota, Sami, Diesel, 100., 6.76,5, 310 Truck, Ridgeline, DUG700, Honda, Waleed, Diesel, 83.279, 7.23, 5, 250 Sample of printed line on out file: ModelName: Camley, Brand: Toyota, Owner: Ahmad, Engine Type: Gasoline, TankSize: 70.0, Fuel Consumption: 15. 15, NumberOfSeat: 5, Movable distance: 1060.5 Km, Cost for 100 km: 943.90 NIS Set of instructions: 1.Create folder at your desktop with your Assignment#, ID, and your name Example: A2_1190100_Ali Mohammad 2. Create a new project using Eclipse IDE and store your project inside this folder. 3.Zipped this folder and submit it by your ITC account [under meta course ]. Grading policy and general notes on the Assignment: 1. Your application should have all functionalities working properly. Twenty percent of marks will be graded for the functionality of the assignment. 2. The following notes will make up the remaining 10 marks of the grade: a. There has to be adequate documentation and comments in the code(i.e., methods, loops, etc.); b. Your code should follow the code convention (i.e., spaces, indentations, etc.); and 3. Any plagiarized code will not be marked. 4. ANY LATE Assignment will never be accepted for any excuse. Types of cheating: Types of cheating: 1. Getting codes form outsource, like books, internet. 2. Cheating from any classmate. 3. Trying to get wers from any website. 4. Trying to get answers from the Facebook groups or from any social media. 5. Trying to get answer from Chegg website. FINAL PROJECT : (YOU CAN USE ALL CONCEPTS YOU LEARNED IN THIS COURSE) Objectives: In this assignment, you will apply the following concepts you learned in java (abstract class, interfaces, Polymorphism, exception handling, Files manipulation and encapsulation). Palestinian Vehicle Agency: A vehicle of three types (car, minivan, and truck) has many attributes. [Question] Designing Vehicle class and Its Sub-classes There are several Vehicles for transportation such as Car, Minivan, and Truck. Details of the classes for the vehicles are shown in the Figure1 > > Cloneable Comparable Owner Comapre To(Obj): int abstract class Vehicles Name:String #modelName:String PIN:String Address:String #ModelNo:String #Brand:String #engine Type:String MobileNO:String Petroleum Type 1 Date OBirth: Date +DIESEL:int #tunk Size:double +GASOLINE. getAge(: double #Fuel consumption:double gasolinePrice:double toString +Owner -diesel Price:double + abstract costFor 100Km) +getDiesel Price().double +Movable-distance) + abstract setAir Condition ONO +getDiesel Price():double +Set GasolinePricedouble) +set Diesel Price (double) + abstract setAirCondition of 4 Car Truck -NumberOfSeats:int Minivan - airCondistionON: Boolean power.int -NumberOfSeats:int -airCondistionON:Boolean -NumberOfSeats:int -airCondistionON: Boolean +toString +setAir ConditionON_Off():Boolean +costFor 100Km(Petroleum Type) - hasAutoDoors:Boolean setAir ConditionON_Oft():Boolean costFor 100Km(Petroleum Type) + setPower) +setNumberOfseats) +toString +toString +setAir ConditionON_Off():Boolean +costFor 100Km(Petroleum Type) setNumberOfseats) +setNumberOfseats) +setHasAutoDoors() 1 Request of the question: Write Java program code to realize the Figure .1 Description of the fields and methods of the classes as follows: 1. For Fields Model-name: Model name of a vehicle Brand: Company to produce the model Owner: Owner of the vehicle (as object) Engine-type: Type of the engine. Classified by fuel type to be used such as gasoline, diesel, or hybrid Tank-size: Size of fuel tank. Unit is liter. Fuel consumption: Fuel consumption. Unit is km/liter. numberOfSeats: Integer number of seats in a vehicle. airConditionOn: Boolean status of air-condition's working: ON/OFF. hasAutoDoor: Boolean status of a vehicle's having auto door. power: Horse Power of a vehicle's engine. Diesel is public static final int=1, and gasoline is public static final int=2 2. For Methods . Movable-distance(): Getting information of movable distance of a vehicle when the tank of the vehicle is filled fully. costFor 100Km(Petroleum-Price): Calculating cost for running 100Kms with the engine type and the petroleum type passed by as parameter. It will be different according to fuel and air-condition's status. setAirCondition ON: Setting the air-condition of the vehicle to ON. You can guess other methods. You have to add your owns methods, at least one additional method for each class, other than mentioned above. Create appropriate setters and getters for classes. . 3. Some conditions to write methods . The Car uses only gasoline engine. The Minivan can use engine of both gasoline and diesel. But the fuel consumption is same for both gasoline and diesel. The Truck uses only diesel engine. The engine type Hybrid uses only gasoline. Default air-condition status is OFF, and the air-condition can be ON/OFF after instances being created by setAirConON/setAirConOFF methods. Default fuel consumption is considered when air-condition is OFF. Fuel consumption of the Car increased by 10% when air-condition of the Car is ON. Fuel consumption of the Minivan and the Truck increased by 20% when air-condition of the Car is ON. For Petroleum Price: Gasoline get price from console NIS/liter, for instance 5.23 Nis/liter)), Dieselget price from console NIS/liter, for instance 4.02 NIS/liter) Use Exception Handling to handle errors caused by mismatch filling type of Petroleum, throw an illegal argument exception Date: you have to use Calender class (Gregorian calender). Use StringBuilder class to deal with string manipulations when read from file. (splitting, uppercase, lowercase,....etc) . Appropriately implement the above hierarchy and stick to the following All Vehicle objects are comparable based on the costFor100km. Clone an instance of Vehicle object, without cloning the owner of this Vehicle (set the owner to null for cloned object) Using deep cloning.toString() method should be implemented in appropriate way in all Vehicle sub classes displaying all the information including the costFor 100Km. 2 Create a menu that allow user to select from them as the following: 1. Read the data about objects from the file "inputdata.txt" and store them in Arraylist. 2. Set prices of petroleum. 3. Print sorted order Vehicles in an ascending order based on costFor 100Km. 4. (Bonus ) Print sorted order Vehicles in an ascending order based on owner name. 5. (Bonus ) Print sorted order Vehicles in an descending order based on vehicle brand. 6. Clone Vehicle without owner. (Ask user to choice one object for cloning from Arraylist, after Listing them to user) 7. Turn air-condition on 8. Write Output on the "output.txt" file after sort them. 9. Exit from System Note: when turn air-condition is on, you can again select one of steps 3-6, the output should be print on file. The file input format is: Car, Camley, E100, Toyota, Ahmad, Gasoline, 70.0, 15. 15,5 Car, Aqua, ES500, Toyota, Nader, Hybrid, 36.0, 40.0, 5 MiniVan, Sienna, A4, Toyota, Malik, Gasoline, 75. 0,9. 0,8, true Mini Van, Odyssey, S500, Honda, Khaled, Diesel, 56.0, 11.0, 8, false MiniVan, Presage, BX5000, Nissan, Shaher, Gasoline, 60.0, 7.0, 7, false Truck, Tundra, EDGE500, Toyota, Sami, Diesel, 100., 6.76,5, 310 Truck, Ridgeline, DUG700, Honda, Waleed, Diesel, 83.279, 7.23, 5, 250 Sample of printed line on out file: ModelName: Camley, Brand: Toyota, Owner: Ahmad, Engine Type: Gasoline, TankSize: 70.0, Fuel Consumption: 15. 15, NumberOfSeat: 5, Movable distance: 1060.5 Km, Cost for 100 km: 943.90 NIS Set of instructions: 1.Create folder at your desktop with your Assignment#, ID, and your name Example: A2_1190100_Ali Mohammad 2. Create a new project using Eclipse IDE and store your project inside this folder. 3.Zipped this folder and submit it by your ITC account [under meta course ]. Grading policy and general notes on the Assignment: 1. Your application should have all functionalities working properly. Twenty percent of marks will be graded for the functionality of the assignment. 2. The following notes will make up the remaining 10 marks of the grade: a. There has to be adequate documentation and comments in the code(i.e., methods, loops, etc.); b. Your code should follow the code convention (i.e., spaces, indentations, etc.); and 3. Any plagiarized code will not be marked. 4. ANY LATE Assignment will never be accepted for any excuse. Types of cheating: Types of cheating: 1. Getting codes form outsource, like books, internet. 2. Cheating from any classmate. 3. Trying to get wers from any website. 4. Trying to get answers from the Facebook groups or from any social media. 5. Trying to get answer from Chegg website

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

To solve p + 3q = 5z + tan( y - 3x)

Answered: 1 week ago