Question: JAVA (30 points) You are going to develop a class to represent Car. *For the instance variables, add the below ones. Make sure that these

JAVA (30 points) You are going to develop a class to representCar. *For the instance variables, add the below ones. Make sure thatthese values cannot be accessed from other classes. Brand of the carJAVA

(30 points) You are going to develop a class to represent Car. *For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes. Brand of the car Price of the car Model of the car Segment of the car (For example A, B, C or D) Number of purchases *Write at least two constructors (not the default one) (Hint: When you first create a car, purchases should be 0) *For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation) *Add an additional buy method that increases the purchase amount *Override the toString method. Return everything in a proper format. *Implement a class that will represent a car Gallery. *For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes. name of the gallery number of cars cars[] cars[] *Write at least two constructors (not the default one) *For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation) *Write one additional method to add cars to a gallery. *Write one additional method to search a car by the segment in this gallery. If you can find any car belonging to the given segment, display them. *Write one additional method to search a car by the price in this gallery. If you can find a car (or cars) smaller than or equal to a given price, display them. *Write another method to decide the top-selling car in this gallery and return it. (which is the most purchased car.) *Override the toString method. Return everything including the car properties. *Finally, use this class with a main method. Create a couple of cars. Then create a gallery with these cars. Buy them randomly. Search the cars, call the necessary methods and at the end show us which car is the top-selling car and which one is the most expensive one. The general flow is up to you but make sure you call search methods, buy method, add method and tostring methods. WHEN YOU COPY PASTE YOUR CODE TO THE BELOW AREA, THE FORMAT SHOULD BE LIKE THIS: COPY THE CLASS CAR (ADD THIS DASHES TO SEPERATE THE CLASSES COPY THE GALEERY CLASS (ADD THIS DASHES TO SEPERATE THE CLASSES COPY YOUR MAIN METHOD

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!