Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

****This needs to be written in C#**** Please remember this is an entry level co

ID: 3701151 • Letter: #

Question

****This needs to be written in C#****

Please remember this is an entry level course, so the code must reflect that.

I need to create a program for Vacation Rentals App. The guests can rent beach equipment such as flotation rafts, Swimming gear, chairs, umbrellas and row boats. The application will first get the guest name, all the items rented, then the qty of each item rented and total minutes rented. The guests can rent as many items as they would like, and multiple quantities. We can assume that all items are rented for the same time frame. So a guest can rent 3 chairs, and swimming gear – but all for 60 minutes.

This program will require three classes, the VacationRentalsApp which will be the entry point of the program, a Rental class which you will be using to create the rented objects, and a Guest class which holds all guest information.

VacationRentalsApp – This is where the program begins. This should create a guest object. The guest object will hold the guest name, contract number and an array of Rental objects. The app should first display the welcome message, and then get the guest information as well as the rental information. All of the info displayed and gathered in the main() method should be called from methods within the BeachRentalsApp class.

Contains the following methods:

The main() – instantiates a Guest object, and as many Rental objects as required. Rental objects are then stored in an array data element in the Guest object i.e. itemsRented[ ]. The main method should call methods to get input and display data. Methods to call in this class should include:

1.) Display a welcome message

2.) Get the guest name

3.) Get the contract number

4.) Gets minutes rented – a guest has to rent for a minimum of an hour and no more than 8 hours.

5.) Gets the item to rent and qty

6.) displays the static array from the Rental Class

7.) Gets the qty and item to rent

Displays the final rental info:

8.) Guest name

9.) For each item: item rented, total cost of rental (price of item * rental period)

10.) A final total of all items rented

Guest – A class that holds guest info

Properties:

Guest Name

Contract Number (ie K168)

# Hours rented

# Minutes rented

Items Rented (an array of rental objects)

Constructors as appropriate: requires a minimum of guest name to instantiate a guest object.

Methods:

Sets the contract Number. If no number is provided, create a random contract number. It should start with the first letter of the customer name, and then a randomly generated additional 4 numbers.

Accepts the minutes rented and sets the class data fields (# hours rented, # minutes rented) accordingly.

Rental – A class that describes a rental

Constructors as appropriate. Users of this class need a minimum of a rental item to instantiate an object.

Static members:

- an array of the rental items available (such as flotation rafts, swimming gear, chairs, umbrellas, row boats)

- The hourly rate for each of the following is:

flotation raft – $15

swimming gear – $25

chairs – $8

umbrella – $10

row boat - $40

Properties:

item Rented (ie umbrella)

qty rented (ie 4 umbrellas)

total rental price (ie umbrella cost $10 * rental period * 3 umbrellas)

Methods

static method that displays the items available for rental

calculates total price - calculated in half hour increments. For example. An umbrella costs $8 per hour. If the rental period is 30 minutes, the price is $4. Otherwise the price is $8. So a rental of 75 minutes costs $12. (1 hour is $8 and additional up to 30 minutes is $4) A rental of 45 minutes costs $8.

Explanation / Answer

/*hi i have written program which will ask you guest name, contract item to be taken for rent, cost for item, total cost. Hope this helps you.

package example;
import java.util.Scanner;

import java.util.Arrays;
public class Guest {

private int length;
private Scanner sc=new Scanner(System.in);
private int noGuest;
private String names[];
public void guests(int noGuest){
    String names[]=new String[noGuest];
   
   for (int i=0;i<=noGuest-1;i++){
    
     names[i]=sc.next();
    
   }System.out.println("Guest name"+ Arrays.toString(names)) ;
  
System.out.println ("Contract number :") ;

String contract=sc. next() ;
}

public void rental(){
    String rentalItem=null;
    System.out.println("Please choose your rental items 1.chairs 2.gear");
   int r=sc.nextInt();
   if(r==1)
   rentalItem="chair";
   else
   rentalItem="gear";
   System.out.println ("Cost of "+rentalItem+" rupees 3 for 60 minutes. Let us know how many minutes do you want to use it:");

int minutes = sc.nextInt() ;
while (minutes>=480){
    System.out.println("You can use only 8 hours that is 480minutes");
minutes =sc.nextInt();
}
System.out.println("How many "+rentalItem+" do you need");
int items=sc.nextInt();
System.out.println ("Your cost will be "+minutes *items*3+" rupees for" + items +" for "+minutes +" minutes" ) ;

}

public static void main(String[] args) {
   
   Scanner sc=new Scanner(System.in);
   System.out.println ("No of guest");
    int noGuest =sc.nextInt();
   System.out.println("Enter name of guest. Please press enter after each name");
Guest e = new Guest ();
   e.guests(noGuest);
   e. rental();
}
}