Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A.Create a class called Trip with Private Attributes: tripID (int) location (String) pricePerPerson (double) Public Methods: constructor: Receives values for the attributes as parameters

Part A.Create a class called Trip with

Private Attributes: tripID (int)

location (String)

pricePerPerson (double)

Public Methods:

constructor: Receives values for the attributes as parameters and initializes them.//argument constructor

display: Displays the trip information, including tripID, location, and pricePerPerson.

computeCost: This method takes an integer parameter to represent the number of people coming on the trip, and returns the computed cost using the number of people and pricePerPerson attribute.

Part B. Complete the implementation for a class called Cruise, described below. The Cruise class inherits the class Trip and represents a more specific type of trip package that has a cruise. It has additional attributes to include a list of ports of call, as well as an attribute for cruise fees.

The Cruise class should have the following:

Private Attributes: portsOfCalls(int):number of ports the cruise will stop in

fees (double): fees for the cruise

Public Methods:

constructor: receives all Trip and Cruise attributes as parameters. This constructor initializes the Cruise attributes, and sends the appropriate variables to the super class constructor.

display: Displays the information in the Trip and Cruise classes. (We will need to call a method in the super class within this method.)

computeCost: This method takes an integer parameter for the number of people and computes the cost, which now includes the cruise fees. (We will need to call a method in the super class within this method).

Part C

Completing a main method Complete the main method in the RunCuise class to demo the Cruise class. Declare and initialize variables you will need to initialize a Cruise object. Create an object of the Cruise class and send the appropriate arguments to the constructor. Display the Cruise information by calling the display method. Prompt the user to enter how many people will be going on the trip, and display the cruise cost.

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

Step: 3

blur-text-image

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

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

Under what circumstances should densities be low? high?

Answered: 1 week ago