C:\>javac TestBookingJO.java C:\>java Test BookingJO Total Booking O Total payment received:RM 900.0 Booking Details ***************** OK Nane of booking=Ahnad Fauzi Bin Isnail Address of booking=NO.1 Tnn Impiana,81100 J Phone nunber-011-23456789 Price = RM 200.00 Nane of booking=Ali Bin Isnail Address of booking-No. 2 Tnn Bahagia, 84000 Muar, Malaysia Phone nunber=012-1234567 Price = RM 400.00 Nane of booking=Siti Aminah Binti Mahnud Address of booking-No. 3 In Cenerlang, 83000 Batu Pahat, Malaysia Phone nunber-019-3867534 Price - RM 300.00

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

 MODIFY THE CODE BELOW TO MAKE THE OUTPUT SAME AS IN THE PICTURE

 

Booking.java file:

 

class Booking{
    // declare variables 
    String name, address, phone;
    double price;
    static int countBooking = 0;
    static double totalPay = 0;
    
    // define class constructors 
    Booking(){ this.countBooking++; }
    Booking(String name, String phone){
        this.countBooking++;
        this.name = name;
        this.phone = phone;
    }

    // define getter and setter methods 
    String  getName(){
        return this.name;
    }

    String getAddress(){
        return this.address;
    }

    String getPhone(){
        return this.phone;
    }

    double getPrice(){
        return this.price;
    }

    double getTotalPay(){
        return this.totalPay;
    }
    
    void setName(String name){
        this.name = name;
    }

    void setAddress(String address){
        this.address = address;
    }

    void setPhone(String phone){
        this.phone = phone;
    }

    void setPrice(double price){
        this.price = price;
    }

    
    void display(){
        // display all the details 
        System.out.println("Name of booking="+this.getName());
        System.out.println("Address of booking="+this.getAddress());
        System.out.println("Phone number="+this.getPhone());
        System.out.println("Price = RM "+this.getPrice());
        System.out.println("\n");
        this.totalPay = this.totalPay+ this.getPrice();
       
        }
}
 
 
TestBooking.java file:
 
public class TestBooking {
    public static void main(String[] args) {
        // create Object and call methods 
        

        // print header
        System.out.println("*****************");
        System.out.println("Booking Details");
        System.out.println("*****************\n");

        Booking booking1 = new Booking();
        booking1.setName("Ahmad Fauzi Bin Ismail");
        booking1.setAddress("No. 1 Tmn Impiana, 81100 Johor Bahru, Malaysia");
        booking1.setPhone("011-23456789");
        booking1.setPrice(200);
        booking1.display();

        Booking booking2 = new Booking("Ali Bin Ismail", "012-1234567");
        booking2.setAddress("No. 2 Tmn Bahagia, 84000 Muar, Malaysia");
        booking2.setPrice(400);
        booking2.display();

        Booking booking3 = new Booking();
        booking3.setName("Ahmad Fauzi Bin Ismail");
        booking3.setAddress("No. 3 Tmn Cemerlang, 83000 Batu Pahat, Malaysia");
        booking3.setPhone("019-3867534");
        booking3.setPrice(300);
        booking3.display();

       // print footer
        System.out.println("*****************");
        System.out.println("Total Booking: "+booking3.countBooking);
        System.out.println("Total Payment received: RM"+booking3.getTotalPay());
        System.out.println("*****************\n");
    }
}
 
GA. Administrator: Command Prompt - java TestBookingJO
C:\>javac Test BookingJO.java
Total Booking
C:\>java TestBookingJO
***************
Booking Details
Total payment received:RM 900.0
Nane of booking=Ahnad Fauzi Bin Ismail
Address of booking=NO.1 Tn Impiana,81100 J
Phone nunber-011-23456789
Price = RM 200.00
OK
Name of booking-Ali Bin Ismail
Address of booking=No. 2 Tmn Bahagia, 84000 Muar, Malaysia
Phone nunber=012-1234567
Price = RM 400.00
Nane of booking=Siti Aminah Binti Mahmud
Address of booking=No. 3 Tmn Cenerlang, 83000 Batu
Phone nunber-019-3867534
Price = RM 300.00
Pahat, Malaysia
Transcribed Image Text:GA. Administrator: Command Prompt - java TestBookingJO C:\>javac Test BookingJO.java Total Booking C:\>java TestBookingJO *************** Booking Details Total payment received:RM 900.0 Nane of booking=Ahnad Fauzi Bin Ismail Address of booking=NO.1 Tn Impiana,81100 J Phone nunber-011-23456789 Price = RM 200.00 OK Name of booking-Ali Bin Ismail Address of booking=No. 2 Tmn Bahagia, 84000 Muar, Malaysia Phone nunber=012-1234567 Price = RM 400.00 Nane of booking=Siti Aminah Binti Mahmud Address of booking=No. 3 Tmn Cenerlang, 83000 Batu Phone nunber-019-3867534 Price = RM 300.00 Pahat, Malaysia
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY