QuestionQuestion

Create an application containing an array that stores eight integers. The application should (1) display all the integers, (2) display all the integers in reverse order, (3) display the sum of the eight integers, (4) display all values less than 5, (5) display the lowest value, (6) display the highest value, (7) calculate and display the average, and (8) display all values that are higher than the calculated average value.

Create a class named CarRental that contains fields that hold a renter’s name, zip code, size of the car rented, daily rental fee, length of rental in days, and total rental fee. The class contains a constructor that requires all the rental data except the daily rate and total fee, which are calculated, based on the size of the car: economy at $29.99 per day, midsize at $38.99 per day, or full size at $43.50 per day. The class also includes a display() method that displays all the rental data.

Create a subclass named LuxuryCarRental. This class sets the rental fee at $79.99 per day and prompts the user to respond to the option of including a chauffeur at $200 more per day. Override the parent class display() method to include chauffeur fee information. Write an application named UseCarRental that prompts the user for the data needed for a rental and creates an object of the correct type. Display the total rental fee.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class CarRental {

String name, size, zipCode;
int lengthOfRental;
double dailyRentalFee, totalFee;

public CarRental(String name, String zipCode, String size, int lengthOfRental)
{
this.name = name;
this.size = size;
this.zipCode = zipCode;
this.lengthOfRental = lengthOfRental;

if(this.size.compareTo("economy") == 0)
{
dailyRentalFee = 29.99;
}
else if(this.size.compareTo("midsize") == 0)
{
dailyRentalFee = 38.99;
}
else if(this.size.compareTo("full size") == 0)...
$36.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats