Question: 3) The class Ticker has been coded as follows: public class Tieket i. privare double price; privare char service; public Ticket double nevprice, char newService

3) The class Ticker has been coded as follows: public class Tieket i. privare double price; privare char service; public Ticket double nevprice, char newService ! l setPrice( newPrice ): geservice newservice if 1 1 a) Write the mudaters (sotPrice and zetSenice method) 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. b) Write the cccessor (getPrice and gerSerice mothodi) for the Ticket class. c) Code a method that a matchet the value of aervice if it as A, it changes to B, if if is B, it changes 10 in d) Code the toSonng method: ir zeturna the service and pnce separated by a (colon) as in the followang exampley. Exarpla :5 Ei34izs Fraple : c) Code a method that switches the value of service: if it is A, it changes to B; if it is B, it changes to A. d) Code the toString method: it returns the service and price separated by a : (colon) as in the following examples: Example 1: B:34.39 Example 2: A:94.99 Exarple 3: B:44.99 e) What is the data type of the parameter and the retum type of the tax method? Fublse doubie sax fleat rate f) In a clieat class and inside the main method, mr Iickrt is an object reference of type Ticler; call the method tax with my Ticket, assuming a tax rate of 0.06, and assign the resulting tax value to a varable named myI cx. ALCat =axRa:e = 0,064t g) Connder the following sonstant of class indir h) In a client class and mnde nein, inte a statement is cutput the value of the sbove sonstant
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
