Ride.java This class represents any amusement park ride. Ride should never be instantiated. Instead, it should only serve as a superclass for more specific rides. Variables: For fields in Ride, use the most restrictive visibility modifier that allows the fields to be accessible from any subclass. String name This variable should be immutable after construction of an instance. double profits the total amount of money this ride has made, always initially 0 int lastInspection the number time ride has completed since the last inspection String[] passengers the names of passengers aboard this ride. Constructors: a) A constructor that takes in name, lastInspection, and passengers. passengers argument array must be deep copied to the corresponding instance field. should not simply copy the reference of the input array and assign it to the instance field. b) A constructor that takes in name, passengers, and sets lastInspection to 0.
Ride.java This class represents any amusement park ride. Ride should never be instantiated. Instead, it should only serve as a superclass for more specific rides. Variables: For fields in Ride, use the most restrictive visibility modifier that allows the fields to be accessible from any subclass. String name This variable should be immutable after construction of an instance. double profits the total amount of money this ride has made, always initially 0 int lastInspection the number time ride has completed since the last inspection String[] passengers the names of passengers aboard this ride. Constructors: a) A constructor that takes in name, lastInspection, and passengers. passengers argument array must be deep copied to the corresponding instance field. should not simply copy the reference of the input array and assign it to the instance field. b) A constructor that takes in name, passengers, and sets lastInspection to 0.
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 2GZ
Related questions
Question
Given the following instructions and starter:
Would this be the right way to implement the variables and constructors?
I'm a bit confused on how to deep copy the passenger array.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Is there any other way to deep copy without having to create the helper method?
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage