5/11/2014 https://lms.rmit.edu.au/bbcswebdav/pid-5155844-dt-content-rid-10250735_1/courses/COSC1073_1410/CarBooking.java https://lms.rmit.edu.au/bbcswebdav/pid-5155844-dt-content-rid-10250735_1/courses/COSC1073_1410/CarBooking.java 1/2 import java.io.*; import java.util.Scanner; /* * class VehicleBooking * * Implemented by Craig Hamilton on Implemented by Craig Hamilton on 28/04/2014 * * This is a sample solution for the CarBooking class -you may * either work off this version of the CarBooking class or import * your own version from Assignment 2 as you wish. * */public class CarBooking { //instance variables -Ass 2 Stage A requirement (i) private String bookingID; private String registrationNumber; private String vehicleDescription; private boolean insuranceIncluded; //class constants -Ass 2 Stage A requirement (ii) private static final double BASIC_BOOKING_FEE = 150; private static final double INSURANCE_SURCHARGE = 50; //constructor -Ass 2 Stage A requirement (iii) public CarBooking(String bookingID, String registrationNumber, String vehicleDescription) { this.bookingID = bookingID; this.registrationNumber = registrationNumber; this.vehicleDescription = vehicleDescription; insuranceIncluded = false; } //accessors -Ass 2 Stage A requirement (iv) public String getBookingID() { return bookingID; } public String getRegistrationNumber() { return registrationNumber; } //getBookingFee() -Ass 2 Stage A requirement (vi) public double getBookingFee() { double bookingFee = BASIC_BOOKING_FEE; if (insuranceIncluded == true) { bookingFee = bookingFee + INSURANCE_SURCHARGE; } return bookingFee; } 5/11/2014 https://lms.rmit.edu.au/bbcswebdav/pid-5155844-dt-content-rid-10250735_1/courses/COSC1073_1410/CarBooking.java https://lms.rmit.edu.au/bbcswebdav/pid-5155844-dt-content-rid-10250735_1/courses/COSC1073_1410/CarBooking.java 2/2 //printBookingSummary() -Ass 2 Stage A requirement (vii) public void printBookingSummary() { System.out.println(“Booking ID: ” + this.bookingID);…

The provided code is a Java program for a CarBooking class. This class represents a booking for a car and contains various instance variables, class constants, a constructor, and several methods.

Let’s analyze the code in more detail:

1. Instance variables:
– bookingID: a String variable that represents the booking ID.
– registrationNumber: a String variable that represents the registration number of the vehicle.
– vehicleDescription: a String variable that represents the description of the vehicle.
– insuranceIncluded: a boolean variable that indicates whether insurance is included in the booking.

2. Class constants:
– BASIC_BOOKING_FEE: a constant double variable that represents the basic booking fee.
– INSURANCE_SURCHARGE: a constant double variable that represents the additional fee for insurance.

3. Constructor:
– CarBooking(String bookingID, String registrationNumber, String vehicleDescription): This constructor initializes the instance variables with the provided values. It also sets the insuranceIncluded variable to false by default.

4. Accessors:
– getBookingID(): This method returns the booking ID.
– getRegistrationNumber(): This method returns the registration number of the vehicle.

5. getBookingFee():
– This method calculates and returns the booking fee based on the basic fee and the insurance surcharge. If insurance is included in the booking, the method adds the additional fee to the basic fee.

6. printBookingSummary():
– This method prints the booking summary, including the booking ID.

Overall, the provided code represents a CarBooking class that can be used to create booking objects for cars. It includes functionality for setting and retrieving booking details, calculating the booking fee, and printing the booking summary.

It’s important to note that the provided code is only a portion of the complete program. It seems to be a sample solution for a class assignment, and there may be additional code in other files that interacts with the CarBooking class.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer