Question: Complete the following tasks: a. Create a class named Trip that includes four string variables: destination (for example, London), means of transportation (for example, air),
Complete the following tasks:
a. Create a class named Trip that includes four string variables: destination (for example, “London”), means of transportation (for example, “air”), departure date (for example, “12/15/2015”), and trip’s purpose (for example, “business”). Include two overloaded constructors. The default constructor sets each field to “XXX”. The nondefault constructor accepts four parameters—one for each field. Include two overloaded display() methods. The parameter less version displays all the Trip details. The second version accepts a string that represents a destination and displays the Trip details only if the Trip’s destination matches the parameter.
b. Create an application that instantiates several Trip objects and demonstrates all the methods.
Step by Step Solution
3.23 Rating (167 Votes )
There are 3 Steps involved in it
ANSWER a Create a class named Trip that includes four string variables destination for example London means of transportation for example air departur... View full answer
Get step-by-step solutions from verified subject matter experts
