Question
Intro to JAVA Course: -------------------------------------------- Complete the class below that uses static methods to track how many rental cars are rented and available. A newly
Intro to JAVA Course:
--------------------------------------------
Complete the class below that uses static methods to track how many rental cars are rented and available. A newly constructed rental car is available for rental.
/** A rental car with static methods to count rented and available cars. */ public class RentalCar { private boolean rented; private static int . . .; private static int . . .;
/** Constructs a rental car. */ public RentalCar() { // your work here }
/** Get number of cars available. @return count of cars that are available */ public static int numAvailable() { // your work here }
/** Get number of cars rented. @return count of cars that are rented */ public static int numRented() { // your work here }
/** Try to rent this car. @return true if the car was successfully rented, false if it was already rented */ public boolean rentCar() { // your work here }
/** Return rented car. @return true if the car was previously rented and is now returned, false if it was not previously rented */ public boolean returnCar() { // your work here } }
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