183k views
3 votes
Write the complete class declaration for the class Advance. Include all necessary instance variables and implementations of its constructor and method(s). The constructor should take a parameter that indicates the number of days in advance that this ticket is being purchased. Tickets purchased ten or more days in advance cost $30; tickets purchased nine or fewer days in advance cost $40. Write the complete class declaration for the class StudentAdvance. Include all necessary instance variables and implementations of its constructor and method(s). The constructor should take a parameter that indicates the number of days in advance that this ticket is being purchased. The toString method should include a notation that a student ID is required for this ticket. A StudentAdvance ticket costs half of what that Advance ticket would normally cost. If the pricing scheme for Advance tickets changes, the StudentAdvance price should continue to be computed correctly with no code modifications to the StudentAdvance class.

1 Answer

3 votes

Answer:

Step-by-step explanation:

The following Java code creates both the Advance class and Student Advance class. The StudentAdvance class extends the Advance class and uses its constructor to always be up to date even when there are changes in the Advance class. Due to technical difficulties I have attached the code as a txt file below.

Write the complete class declaration for the class Advance. Include all necessary-example-1
User TransformerTroy
by
5.0k points