Practice Program with Arrays

Suoritettu Julkaistu 5 vuotta sitten Maksettu toimituksen yhteydessä
Suoritettu Maksettu toimituksen yhteydessä

Design:

You must have a minimum of a Vehicle class, CarLot class and TextMenu class, as well as a CarLotDriver class. Make sure your output is easy to read and formatted appropriately. A sample run has been provided.

Vehicle Class:

• Instance Variables:

o VIN number

o Make and model of vehicle

o Year

o Value of vehicle

o Total miles driven

o Miles of vehicle on last oil change

o Vehicle Type, which should be stored as a character, either C or T

• Methods:

o Two constructors, one that takes the vin, make, model, year, value and vehicle type and the other that also includes total miles and last oil change miles

o needsOilChange()- this method will determine if a vehicle is in need of an oil change. It returns a Boolean value based on the following criteria. A car requires an oil change if it is 3000 or more mile since last oil change and a truck is 10000 or more miles.

o depreciate- this method accepts a double value that represents a percentage and returns the amount the vehicle value will be depreciated by, based on the depreciated percentage.

o shouldRetire()- this method should return a Boolean value that determines whether a vehicle is ready to be retired based on the following criteria:

 For a car: total miles is over 100,000 and more than 5 years old

 For a truck: total miles is over 200,000 and more than 7 years old

o toString()- See sample run for toString format

o getCurrentYear()- This method retrieves the current year from the system and returns it as an integer. The code for this is: return [login to view URL]; You will then need to import the Calendar from java.util.

o only the getters and setters that are actually used.

CarLot class:

• Instance Variables:

o An array that stores Vehicles that represents the fleet of vehicles

o A variable that represents the count for the number of vehicles

• Methods:

o Constructor- One constructor that instantiates the array and sets the count to zero

o readFile()- This method accepts a string that represents the name of the file to be read. It will then read the file. It should work for either the car or truck file. Once the data is read, it should create a vehicle and then pass the vehicle to the addVehicle method. It should not allow any duplication of records. Be sure to handle all exceptions.

o writeFile()- This method accepts a string that represent the name of the file to be written to and then writes the contents of the array to a file. This method should call a sort method to sort the array before writing to it.

o sortArray()- This method returns a sorted array. The array is sorted by vin number.

o addVehicle()- This method accepts a Vehicle instance and adds this vehicle to the fleet(the array) only if the vehicle is not already in the list.

o displayFleet()- This method outputs all of the vehicles that are in the fleet.

o displayOilChangeList()- This method outputs all vehicles in the array that require an oil choice

o updateMiles()- This method accepts a vin and miles and updates the total miles for the designated vehicle based on vin

o updateOilChange()- This method accepts a vin and changes the oil change miles to the current miles.

o depreciateFleet()- This method accepts a percentage value and calls the depreciate method for each vehicle in the fleet and updates the values for each vehicle.

o displayVehicle()- This method accepts a vin and searches the array for a vehicle that matches that vin and displays the information about that vehicle.

o removeVehicle()- This method accepts a vehicle and searches the array for that vehicle. For each item that doesn’t match, it will copy the contents to the new array. It will not copy the contents of the vehicle that is found. In other words, all vehicles in the array will be moved up a position to fill in the gap in the array.

Java Tietojärjestelmäarkkitehtuuri

Projektin tunnus: #18322187

Tietoa projektista

7 ehdotusta Etäprojekti Aktiivinen 5 vuotta sitten

Myönnetty käyttäjälle:

Bhawandtu

I have 3 years of working experience in Java and I can do this task easily. Looking forward for a positive response from you.

$25 USD 1 päivässä
(30 Arvostelua)
4.5

7 freelanceria on tarjonnut keskimäärin $36 tähän työhön

ITPyramid85

hello,how are you.i read your bid carefully. i am java/javafx expert and have full experience for 12 years. java/javafx is my top skill and passision. i can provide most quality and high speed. if you want to succe Lisää

$100 USD 1 päivässä
(27 arvostelua)
6.9
usman1493

Hello Sir, Greetings, A Java expert developer is here I have good advanced expertise in Java I can help you with your work in Java This is an initial bid Sir, Feel free to message me Regards

$20 USD 1 päivässä
(232 arvostelua)
6.8
abrahambrons

Hi, nice to meet you, i can help you with the Java assigment, im good with OOP and files, please contact me if you need the job, we can discuss details and payment in chat

$25 USD 1 päivässä
(39 arvostelua)
5.4
indianitdevelopm

Hi i have two year experience in web and app development field. i am new to freelancer but not in technology So please give me a chance to work with your project Thanks.

$25 USD 1 päivässä
(6 arvostelua)
2.5
rupeshkarna11

Hello! I am the man for this job. My name is Rupesh and I am Computer Engineering graduate. I have been programming in Java for almost 3 years and since everybody tells me I am good at solving problems, I have decided Lisää

$25 USD 7 päivässä
(1 arvostelu)
1.0
arcsoft16

Dear Prospect Hiring Manager. Thank you for giving me a chance to bid on your project. i am a serious bidder here and i have already worked on a similar project before and can deliver as u have mentioned I have Lisää

$29 USD 7 päivässä
(1 arvostelu)
0.0