Solved

The Class Ticket Has Been Coded as Follows

Question 33

Essay

The class Ticket has been coded as follows. Write the mutators (setPrice and setService methods) for the Ticket class. The price must be greater than or equal to 0. The service must be either A or B; the default service is B.
public class Ticket
{
private double price;
private char service;
public Ticket( double newPrice, char newService )
{
setPrice( newPrice );
setService( newService );
}
}

Correct Answer:

verifed

Verified

public void setPrice( double newPrice )
...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents