What would be best way to use LocalDate for needsMaintenance if the aircrafts last mainenace date is 3 months or more or the last maintenance mileage is 150,000 miles or more   ShouldRetire- If the yearsInService is more than 20 years using LocalDate If there are more than 2,000,000 air miles   In Java

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

public class Aircraft

{

// instance vairables

private String aircraftName;

private String regNumber;

private String manufacturer;

privateintmaxRange;

privateintcrewSize;

private LocalDate yearPutInService;

privateintmaxServiceWeight;

privateintnumberOfPassengers;

privateintcurrentAirMiles;

private LocalDate lastMaintenanceDate;

privateintlastMaintenanceMiles;

 

/**

* Default Constructor

*

* @param lastMaintenanceMiles

* @param lastMaintenanceDate

* @param totalMiles

* @param model

* @param manufacturer

* @param regNumber

* @param vehicleType

*/

 

public Aircraft(String aircraftName, String regNumber, String manufacturer, intmaxRange, intcrewSize,

LocalDate yearPutInService, int maxServiceWeight, int numberOfPassengers, int currentAirMiles,

LocalDate lastMaintenanceDate, int lastMaintenanceMiles)

{

{

this.aircraftName = aircraftName;

this.regNumber = regNumber;

this.manufacturer = manufacturer;

this.maxRange = maxRange;

this.crewSize = crewSize;

this.yearPutInService = yearPutInService;

this.maxServiceWeight = maxServiceWeight;

this.numberOfPassengers = numberOfPassengers;

this.currentAirMiles = currentAirMiles;

this.lastMaintenanceDate = lastMaintenanceDate;

this.lastMaintenanceMiles = lastMaintenanceMiles;

}

 

}

 

publicboolean needsMaintenance()

{

LocalDate currentDate = LocalDate.now();

LocalDate maintenanceDate = lastMaintenanceDate.plusMonths(3);

intmaintenance = 150000;

 

if (currentDate.isAfter(maintenanceDate) || currentAirMiles - lastMaintenanceMiles >= maintenance)

{

returntrue;

} else

{

returnfalse;

 

}

}

 

publicboolean shouldRetire()

{

intyearsInService = Period.between(yearPutInService, LocalDate.now()).getYears();

if (yearsInService >= 20 || currentAirMiles >= 2000000)

{

returntrue;

 

} else

{

 

returnfalse;

}

}

 

public String getAircraftName()

{

returnaircraftName;

}

 

public String getRegNumber()

{

returnregNumber;

}

 

public String getManufacturer()

{

returnmanufacturer;

}

 

publicint getMaxRange()

{

returnmaxRange;

}

 

publicint getCrewSize()

{

returncrewSize;

}

 

public LocalDate getYearPutInService()

{

returnyearPutInService;

}

 

publicint getMaxServiceWeight()

{

returnmaxServiceWeight;

}

 

publicint getNumPassengers()

{

returnnumberOfPassengers;

}

 

publicint getCurrentAirMiles()

{

returncurrentAirMiles;

}

 

publicvoid setCurrentAirMiles(intcurrentAirMiles)

{

this.currentAirMiles = currentAirMiles;

}

 

public LocalDate getLastMaintenanceDate()

{

returnlastMaintenanceDate;

}

 

publicvoid setLastMaintenanceDate(LocalDate lastMaintenanceDate)

{

this.lastMaintenanceDate = lastMaintenanceDate;

}

 

publicint getLastMaintenaceMiles()

{

returnlastMaintenanceMiles;

}

 

publicvoid setLastMaintenanceMiles(intlastMaintenanceMiles)

{

this.lastMaintenanceMiles = lastMaintenanceMiles;

}

 

@Override

public String toString()

{

return"Aircraft [aircraftName=" + aircraftName + ", regNumber=" + regNumber + ", manufacturer=" + manufacturer

+ ", lastMaintenanceDate=" + lastMaintenanceDate + ", lastMaintenanceMiles=" + lastMaintenanceMiles

+ "]";

}

 

}

 

What would be best way to use LocalDate for needsMaintenance if the aircrafts last mainenace date is 3 months or more or the last maintenance mileage is 150,000 miles or more

 

ShouldRetire- If the yearsInService is more than 20 years using LocalDate

If there are more than 2,000,000 air miles

 

In Java

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education