a. Sammys Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists.

Question:

a. Sammy’s Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. You created a Rental class for the company. The Rental class contains two public final static fields that hold the number of minutes in an hour and the hourly rental rate ($40), and four private fields that hold a contract number, number of hours for the rental, number of minutes over an hour, and the price. It also contains two public set methods and four public get methods. Now, modify the Rental class to contain two overloaded constructors.

  • One constructor accepts a contract number and number of minutes as parameters. Pass these values to the setContractNumber() and setHoursAndMinutes() methods, respectively. The setHoursAndMinutes() method will automatically calculate the hours, extra minutes, and price.
  • The other constructor is a default constructor that passes “A000” and 0 to the two-parameter constructor. Save the file as Rental.java.

b. You also created a RentalDemo class to demonstrate a Rental object. Now, modify that class to instantiate two Rental objects.

  • Instantiate one object to retain the constructor default values.
  • Accept user data for the contract number and minutes fields and use this data set to instantiate the second object. Display all the details for both objects. Save the file as RentalDemo.java.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Programming

ISBN: 978-1337397070

9th edition

Authors: Joyce Farrell

Question Posted: