Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in java please 7. Write this code for the Car.java file that correspondence to the UML diagram below. Hint: Look at the Human.java code from
in java please
7. Write this code for the Car.java file that correspondence to the UML diagram below. Hint: Look at the Human.java code from the class notes. Important: The price of a car is a random integer number ranging from 25000 - 30000. Look at earlier class notes for hints on this. The default constructor: public Carl), sets the Color to Black and the Number of Doors to 2 Important: This is the output from the displayinfo() method. You need to reversed engineer it. Car Info Cario: 1002 Factory: Michigan Number of Doors: 4 Color White Price: $23798 This is the output from the displayClassInfo() method. You need to reversed engineer it. Car Class into vehicleCounter: CAR_FACTORY_ID: Michigan 1004 N COP2210 Lab3 Source Packages general & Controller.java vehicle Car Java Controller (trom general) +main aras: String: void Car (from vehicle) -vehicle Counter: int = 1000 -CAR FACTORY D. String = "Michigan" (readOnly color: String -factory String -carlo, int -numberOfDoors: int -price: int econstructon+Caro constructor Car(color: String numberOtDoors, int) +getVehicleCounter) int tserveh Counter(vehicle Counter: int); void displayClassInfo:void +getColor: String *setColor(color: String); void -getCarlDO in *setCarib(carb. ant). void *getNumberOtDoorsoint -setNumberOfDoorsnumberotoors, int). void getPrice(unt +setPriceprice in, void +displayintoo void 8. Write this code for the Controller.java main method. You are to write the code for #1-49. The instruction for the code are above the number sign. public static void main(String[] args) { // create Car instance named cl using the default constructor Car el new car // create Car instance named c2 which is white and has 4 doors // *1 YOU WRITE THE CODE HERE // create Car instance named c3 which is Red and has 2 doors 1/ #2 YOU WRITE THE CODE HERE I create Car instance named ct which is Green and has 6 doors // #4 YOU WRITE THE CODE HERE // call the displayInfo method on ci 1/5 YOU WRITE THE CODE HERE // call the display Info method on c2 // 26 YOU WRITE THE CODE HERE 1/ call the displayInfo method on c3 // #7 YOU WRITE THE CODE HERE // call the display Info method on c4 1/ 8 YOU WRITE THE CODE HERE // call the displayCar Info method on the class car // 9 YOU WRITE THE CODE HERE //end main() Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started