Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sammy's Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. In Chapters 3 and 4, you created a Rental

image text in transcribed
Sammy's Seashore Supplies rents beach equipment such as kayaks, canoes, beach chairs, and umbrellas to tourists. In Chapters 3 and 4, you created a Rental class for the company b. In Chapter 4, you modified the Rental Demo class to demonstrate a Rental object. Now, modify that class again as follows: Instantiate three Rental objects, and prompt the user for values for each object. Display the details for each object to verify that the new price calculation works correctly Create a method that accepts two Rental objects and returns the one with the longer rental time. (If the Rentals have the same time, you can return either object.) Call this method three times once with each pair of instan-tiated Rentals and display the contract number and time in hours and minutes for each argument as well as the contract number of the longer Rental. Save the file as RentalDemo.java. Java Programming, 8th Edition Chapter 5 Case Problem 2-b ***Here is the Rental.java I have* rt java.util. public class Rental public static double rental Price(int number of minutes) int hours = number of-minutes/60; //get the total number of hours by dividing minutes by 60 int minutes-number-of-minutes%60; //get the remaining minutes by moduling minutes by 60 if(minutes> 40) if minutes are greater than 40 minutes, hours+1; /count additional one hour minutes=0://and make minutes to 0 double rental Price hours*40 + minutes* I; //calculate rent for number of hours and minutes return rentalPrice public static void main(String[] args) just for testing System.out.println"Enter the number of minutes: "); Scanner s = new Scanner( System.in); int number of.minutes = s.nextInt(); System.out.println" Calculated Rental Price:"+ rentalPrice(number of minutes))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Ehs 2.0 Revolutionizing The Future Of Safety With Digital Technology

Authors: Tony Mudd

1st Edition

B0CN69B3HW, 979-8867463663

More Books

Students also viewed these Databases questions

Question

Comment should this MNE have a global LGBT policy? Why/ why not?

Answered: 1 week ago