You need to program the following classes: MyTravel.java - Class storing the main method. ...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You need to program the following classes: • MyTravel.java - Class storing the "main" method. • Travel.java - Superclass storing common travel information. AirTravel.java Subclass of Travel specific for air travel. • LandTravel.java - Subclass of Travel specific for load travel. Notes that you may add additional methods to any of the classes, but you must follow the specified structure. B.1 Travel Abstract Class Abstract class Travel contains: A protected String data field travelType, either "Air" or "Land". A protected String data field country, e.g. "France", "England", etc. • A protected String data field city, e.g. "Paris", "London", etc. A protected String data field travelDate, e.g. "Jan 30 2022". A protected String data field returnDate e.g. "Feb 20 2022". • A protected int (or Integer) data field days, e.g. 21. A protected String data field hotel, e.g. "Hilton", "Marriott", etc. A protected double (or Double) data field named cost, e.g. 1500. A private int (or Integer) data field travelMileage, e.g. 2000. A constructor method initializing each data field. Methods set and get for each data field. A print method printing the values of all data fields in the class. B.2 AirTravel Class Class AirTravel contains: • A private String data field airline, e.g. "Delta", "United", etc. • A private String data field travelRefNumber, e.g. "A123456", etc. A constructor method initializing each data field. Methods set and get for each data field. A print method printing the values of all variables. B.3 Land Travel Class Class Land Travel contains: A private String data field carType, e.g. "Gas", "Electric". ⚫ A constructor method initializing each data field. • Methods set and get for each data field. ⚫ A print method printing the values of all variables. B.4 MyTravel Class Class MyTravel contains: ⚫ An "init" method where all travel objects are initiated from data read from the input file and stored inside an array called my Travel. ⚫ A "print" method printing all the data fields for each travel object, the total travel days and total cost. The "main" method that calls the init and print methods. B.5 ReadTextFile Class The class "ReadTextFile.java" is given to read individual lines from the text file and assign them to objects. B.6 Text Files The input text file "travel.txt" is given consisting of a numerical line stating the number of travel objects to be read from the file. Each line consists of data separated by commas representing each data field for each object. The number of entries in the input file may change when testing the final code, although it will keep the following format for the file: number of travel objects travell_datal, travell_data2.... travel2_datal, travel2_data2, ... travelN_datal, travelN_data2,... For example: 6 Air, France, Paris, Dec 10 2020,Jan 5 2021,5,Delta, Hilton, A123456,1260.50,5000 Air, France, Lyon, Dec 10 2020, Jan 5 2021,6,Southwest Marriott B123456,1260.50,5500 Air, England,London,Dec 5 2020,Jan 1 2021,7,American Airlines, Embassy Suites, C123456,750.00,6000 Land, Canada, Montreal.Dec 30 2020, Jan 30 2021,8,Aloft,380.00,1000,"Gas" Land, Canada, Toronto, Dec 30 2020 Jan 30 2021,8,Marriott,350.00, 1200, "Electric" Air Italy, Rome, Dec 14 2020, Jan 2 2021,7,Delta, Hilton, F123456,1100.00,4500 B.7 Program Output The output format for the above input file should be as follows: Travel Details TravelType: Air Country: France City: Paris TravelDate: Dec 10 2020 ReturnDate: Jan 5 2021 Days: 5 Hotel: Hilton Cost: 1260.5 TravelMileage: 5000 Airline: Delta TravelRefNumber: A123456 TravelType: Air Country: France City: Lyon TravelDate: Dec 10 2020 ReturnDate: Jan 5 2021 Days: 6 Hotel: Marriott Cost: 1260.5 TravelMileage: 5500 Airline: Southwest TravelRefNumber: B123456 TravelType: Air Country: England City: London TravelDate: Dec 5 2020 ReturnDate: Jan 1 2021 Days: 7 Hotel: Embassy Suites Cost: 750.0 TravelMileage: 6000 Airline: American Airlines TravelRefNumber: C123456 TravelType: Land Country: Canada City: Montreal TravelDate: Dec 30 2020 ReturnDate: Jan 30 2021 Days: 8 Hotel: Aloft Cost: 380.0 TravelMileage: 1000 CarType: "Gas" TravelType: Land Country: Canada City: Toronto TravelDate: Dec 30 2020 ReturnDate: Jan 30 2021 Days: 8 Hotel: Marriott Cost: 350.0 TravelMileage: 1200 CarType: "Electric" TravelType: Air Country: Italy City: Rome TravelDate: Dec 14 2020 ReturnDate: Jan 2 2021 Days: 7 Hotel: Hilton Cost: 1100.0 TravelMileage: 4500 Airline: Delta TravelRefNumber: F123456 Total Days: 41 Total Cost: $5101.0 Total Travel Air Mileage: 21000 Total Travel Land Mileage: 2200 You need to program the following classes: • MyTravel.java - Class storing the "main" method. • Travel.java - Superclass storing common travel information. AirTravel.java Subclass of Travel specific for air travel. • LandTravel.java - Subclass of Travel specific for load travel. Notes that you may add additional methods to any of the classes, but you must follow the specified structure. B.1 Travel Abstract Class Abstract class Travel contains: A protected String data field travelType, either "Air" or "Land". A protected String data field country, e.g. "France", "England", etc. • A protected String data field city, e.g. "Paris", "London", etc. A protected String data field travelDate, e.g. "Jan 30 2022". A protected String data field returnDate e.g. "Feb 20 2022". • A protected int (or Integer) data field days, e.g. 21. A protected String data field hotel, e.g. "Hilton", "Marriott", etc. A protected double (or Double) data field named cost, e.g. 1500. A private int (or Integer) data field travelMileage, e.g. 2000. A constructor method initializing each data field. Methods set and get for each data field. A print method printing the values of all data fields in the class. B.2 AirTravel Class Class AirTravel contains: • A private String data field airline, e.g. "Delta", "United", etc. • A private String data field travelRefNumber, e.g. "A123456", etc. A constructor method initializing each data field. Methods set and get for each data field. A print method printing the values of all variables. B.3 Land Travel Class Class Land Travel contains: A private String data field carType, e.g. "Gas", "Electric". ⚫ A constructor method initializing each data field. • Methods set and get for each data field. ⚫ A print method printing the values of all variables. B.4 MyTravel Class Class MyTravel contains: ⚫ An "init" method where all travel objects are initiated from data read from the input file and stored inside an array called my Travel. ⚫ A "print" method printing all the data fields for each travel object, the total travel days and total cost. The "main" method that calls the init and print methods. B.5 ReadTextFile Class The class "ReadTextFile.java" is given to read individual lines from the text file and assign them to objects. B.6 Text Files The input text file "travel.txt" is given consisting of a numerical line stating the number of travel objects to be read from the file. Each line consists of data separated by commas representing each data field for each object. The number of entries in the input file may change when testing the final code, although it will keep the following format for the file: number of travel objects travell_datal, travell_data2.... travel2_datal, travel2_data2, ... travelN_datal, travelN_data2,... For example: 6 Air, France, Paris, Dec 10 2020,Jan 5 2021,5,Delta, Hilton, A123456,1260.50,5000 Air, France, Lyon, Dec 10 2020, Jan 5 2021,6,Southwest Marriott B123456,1260.50,5500 Air, England,London,Dec 5 2020,Jan 1 2021,7,American Airlines, Embassy Suites, C123456,750.00,6000 Land, Canada, Montreal.Dec 30 2020, Jan 30 2021,8,Aloft,380.00,1000,"Gas" Land, Canada, Toronto, Dec 30 2020 Jan 30 2021,8,Marriott,350.00, 1200, "Electric" Air Italy, Rome, Dec 14 2020, Jan 2 2021,7,Delta, Hilton, F123456,1100.00,4500 B.7 Program Output The output format for the above input file should be as follows: Travel Details TravelType: Air Country: France City: Paris TravelDate: Dec 10 2020 ReturnDate: Jan 5 2021 Days: 5 Hotel: Hilton Cost: 1260.5 TravelMileage: 5000 Airline: Delta TravelRefNumber: A123456 TravelType: Air Country: France City: Lyon TravelDate: Dec 10 2020 ReturnDate: Jan 5 2021 Days: 6 Hotel: Marriott Cost: 1260.5 TravelMileage: 5500 Airline: Southwest TravelRefNumber: B123456 TravelType: Air Country: England City: London TravelDate: Dec 5 2020 ReturnDate: Jan 1 2021 Days: 7 Hotel: Embassy Suites Cost: 750.0 TravelMileage: 6000 Airline: American Airlines TravelRefNumber: C123456 TravelType: Land Country: Canada City: Montreal TravelDate: Dec 30 2020 ReturnDate: Jan 30 2021 Days: 8 Hotel: Aloft Cost: 380.0 TravelMileage: 1000 CarType: "Gas" TravelType: Land Country: Canada City: Toronto TravelDate: Dec 30 2020 ReturnDate: Jan 30 2021 Days: 8 Hotel: Marriott Cost: 350.0 TravelMileage: 1200 CarType: "Electric" TravelType: Air Country: Italy City: Rome TravelDate: Dec 14 2020 ReturnDate: Jan 2 2021 Days: 7 Hotel: Hilton Cost: 1100.0 TravelMileage: 4500 Airline: Delta TravelRefNumber: F123456 Total Days: 41 Total Cost: $5101.0 Total Travel Air Mileage: 21000 Total Travel Land Mileage: 2200
Expert Answer:
Answer rating: 100% (QA)
Traveljava public abstract class Travel protected String travelType protected String country protect... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
The potential losses are sorted in the following table. The absolute VaR is 8 Million. What is the relative expected shortfall from the mean? Sorted returns Returns ( Million) -12 -10 -8 -6 -4 -3 -1.5
-
Weiss Inc. reported income from continuing operations of $87,000 and a loss from discontinued operations of $16,000 in 2017, all before income taxes. All items are fully taxable and deductible for...
-
If F 2 = 150 lb and ? = 55?, determine the magnitude and orientation, measured clockwise from the positive x axis, of the resultant force of the three forces acting on the bracket. F, = 52 Ib F = 80...
-
A pressure cooker contains 0.5 m 3 water and water vapor mixture at 300C. Calculate the mass of each if their volumes are equal.
-
Use Worksheet 2.2. Ross and Cindy Adams are about to construct their income and expense statement for the year ending December 31, 2015. They have put together the following income and expense...
-
What are the legal consequences of using corporate assets for personal use? Back it with primary sources like the internal revenue code, internal revenue manual, treasury regulations.
-
What other countries in addition to the united states utilize the restorative justice model? What are the social and ethical implications of utilizing restorative justice practices on a global level?
-
It was 30 June 2020 and furniture manufacturer, Dysoft Global Bhd is having an Extraordinary General Meeting. Ali is the single largest shareholder with a 25% stake in Dysoft Global. He is also the...
-
Assume Huron Foods Inc. has current assets of $627.5 million, capital assets of $1,064.2 million, and other assets totalling $1,160.0 million. Current liabilities are $592.9 million and long-term...
-
Fickel Company has two manufacturing departments-Assembly and Testing & Packaging. The predetermined overhead rates in Assembly and Testing & Packaging are $20.00 per direct labor-hour and $16.00 per...
-
Fields Company has two manufacturing departments, forming and painting. The company uses the weighted average method and it reports the following unit data for the Forming department. Units completed...
-
1. Explain to Jack (the business owner) the meaning of performance management. 2. Is Jennifer right about the need to evaluate the workers and the managers? Justify Discusses the need to evaluate the...
-
What are the financing techniques that the hospital can use to cover patient accident costs? Which technique(s) do you believe would be the best to use? Why?
-
There can be more than one Euler tour on a line. As the starting and ending points change, different Euler tours can be found. The answer to the question of whether there is an Euler tour or an Euler...
-
Chloroplasts are illuminated until the levels of the Calvin cycle intermediates reach a steady state. The light is then turned off. How does the level of RuBP vary after this point?
-
Create a Contacts app modeled after the Cover Viewer app. Store the contact information in an ObservableList of Contact objects. A Contact should contain first name, last name, email and phone number...
-
An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number, because 6 = 1 + 2 + 3. Write a method...
-
State whether each of the statements that follows is true or false. If false, explain why. a) Its possible to treat base-class objects and derived-class objects similarly. b) All methods in an...
-
The suitability concern discussed by Kroll and Park most likely deals with: A. governance. B. transparency. C. investment horizon. Kevin Kroll is the chair of the investment committee responsible for...
-
Which of Parks statements regarding the asset allocation approaches is correct? A. Only Statement 3 B. Only Statement 4 C. Both Statement 3 and Statement 4 Kevin Kroll is the chair of the investment...
-
Based on the forecasted environment, liquidity planning should take into account that general partners may: A. call capital at a slower pace. B. make distributions at a faster pace. C. exercise an...
Study smarter with the SolutionInn App