Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA (Eclipse) - Using the following templates, complete the program, resulting in the following output. Inputs/Templates Output/Result Case to consider: 8 9 10 11 12

JAVA (Eclipse) - Using the following templates, complete the program, resulting in the following output.
Inputs/Templates
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Output/Result
image text in transcribed
Case to consider:
image text in transcribed
8 9 10 11 12 13 1 import java.util.Scanner; 2 import java.util.Date; 3 class TouristTest{ 4 5 public static void main(String args[]) { 6 int destNumberi; 7 Scanner input = new Scanner(System.in); System.out.println("Enter tourist details."); 17 entering tourist details Tourist tourist = new Tourist(touristName, touristPhone, touristAddress); 1/ set up Vacation class // entering vacation details 14 Vacation vacation = new Vacation(bookDate, travelAgency); 15 //get destionation details 17 while(true) { 18 System.out.println(" Getting details for destination " + destNumber++); System.out.println("Enter exit when all destinations are entered"); 20 17 entering destination details 21 }//end destination details 22 }//end main method 23 static void displayTouristReport(Tourist tourist, Vacation vacation) { 25 // list tourist destinations and dates of visit 26 ) 27 }//end class 16 19 24 1 class Tourist 2 private String name; 3 private String phone; 4 private String address; 5 private Vacation vacation; 6 7 Tourist() { 8 1o-arg constructor 10 Tourist(String name, String phone, String address) { 11 //constructor with arguments 12 ) 13 14 // setter and getter methods 15 public String getName() { 16 17) 18 public String getPhone() { 19 20 ) 21 public String getAddress() { 23 ) 24 public void setName(String name) { 25 26 ) 27 public void setPhone(String phone) { 28 29 } 30 public void setAddress(String address) { 31 32 ) 33 34 }//end class Tourist 22 1 2 import java.util.Date; 3 import java.util.Scanner; 4 class Vacation 5 private String bookDate; 6 private String travelAgency; i private Destination[] destination = new Destination[10]; 8 static int destNum = 0; 9 Scanner input = new Scanner(System.in); 10 11 Vacation 12 1o-arg constructor 13 > 14 Vacation(String bookDate, String agency) { //constructor vith arguments 16 ) 17 18 1/setter and getter methods 19 public String getBookDate() { 20 21 } 22 public String getAgency() { 23 24 } 25 public void setBookDate(String newBookDate) { 15 26 27 > 28 public void setAgency(String newAgency) { 29 30 > 31 public void setDestination(Destination dest) { 32 33 ) 34 35 public String getDestinations() { 36 1/builds lines of tourist's destination report 37 return message; 38 } 39 40 } // end class Vacation WNOLOWN 1 class Destination private String dateofVisit; private double ticketPrice; private String location; private String hotel; private double roomCost; static int destNum; Destination() { 10 1o-arg constructor 11 12 13 Destination(String dateofvisit, double ticketPrice, String location, String hotel, double roomCost) { 14 //constructor with arguments 15 16 17 // setter and getter methods 18 public String getDateofVisit({ 19 20 > 21 public string getLocation() { 22 23 > 24 public double getTicketPrice() { 25 26 ) 27 public String getHotel({ NO HHHHNNNNNN 28 public double getRoomCost() { public void setLocation(String nevLocation) { public void setHotel(String newHotel){ public void setTicketPrice( double newPrice) { 41 43 44 45 46 47 48 49 50 51 public void setDateofvisite(String newDateofvisit) { > public void setRoomCost(double newroomCost) { ) public String toString() { 1/ returns a location and date of visit for a destination 53) // end class Destination 54 Enter tourist details. Tourist name: John Doe Tourist phone: 555-1212 Tourist address: 123 Main Enter vacation details. Enter travel agency: Florence Agency Enter booking date(mm-dd-yyyy): 02-18-2021 Getting details for destination 1 Enter exit when all destinations are entered Enter date of destination visit (mm-dd-yyyy): 02-25-2021 Enter ticket price: 230.ee Enter destination location: Chicago Enter destination hotel: Sheraton Enter hotel room cost: 175.98 Getting details for destination 2 Enter exit when all destinations are entered Enter date of destination visit (mm-dd-yyyy): 03-05-2821 Enter ticket price: 210.50 Enter destination location: New York Enter destination hotel: Hilton Enter hotel room cost: 199.95 Getting details for destination 3 Enter exit when all destinations are entered Enter date of destination visit (mm-dd-yyyy): exit Report for tourist John Doe Vacation date 02-18-2021 Booked with Florence Agency Destinations 1: Chicago 02-25-2021 2: New York 03-05-2021 takes has-a destinations) Tourist Vacation Destination

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago