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
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...
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb0c629b2-7c13-42b9-9351-b4c1e0dab891%2F61739ece-fe2e-47f1-8230-eb54c5e4d512%2F9qnjvy_processed.png&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
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](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY