Question: 7.18.4 Identifying Errors in Code For Questions 38 through 45 , consider that inside the class Gift, we have already coded the following: public class


7.18.4 Identifying Errors in Code For Questions 38 through 45 , consider that inside the class Gift, we have already coded the following: public class Gift \{ private String description: private double price: private String occasion: private boolean taxable: public static final double TAX_RATE = Q.0.0: public Gift( String d, double p, String 0 , boolean t ) \{ description =d; price =Ri occasion =0i taxable=ti 3 public void setprise( double p ) \{ price =pi CSCl228 Assignment 2 3 public void setTaxable ( beolean t ) \{ taxable =ti \} 38. We are coding the following inside the class Gift; where is the error? public void getprice( ) \{ return price; \} 39. We are coding the following inside the class Gift; where is the error? public void seteccasion( String occasion ) \{ occasion = occasion: 3 40. We are coding the following inside the class Gift; where is the error? public String toString( ) i Systen.out priatho( "description ="+ description ); System out,println( "price ="+ price); Systen out, printlo( "occasion = " occasion ); Systed out roriatios "taxable ="+ taxable ) 41. We are coding the following inside the class Gift; where is the error? public boolean equals( Object g ) \{ return ( this =9 ); 7.18.4 Identifying Errors in Code For Questions 38 through 45 , consider that inside the class Gift, we have already coded the following: public class Gift \{ private String description: private double price: private String occasion: private boolean taxable: public static final double TAX_RATE = Q.0.0: public Gift( String d, double p, String 0 , boolean t ) \{ description =d; price =Ri occasion =0i taxable=ti 3 public void setprise( double p ) \{ price =pi CSCl228 Assignment 2 3 public void setTaxable ( beolean t ) \{ taxable =ti \} 38. We are coding the following inside the class Gift; where is the error? public void getprice( ) \{ return price; \} 39. We are coding the following inside the class Gift; where is the error? public void seteccasion( String occasion ) \{ occasion = occasion: 3 40. We are coding the following inside the class Gift; where is the error? public String toString( ) i Systen.out priatho( "description ="+ description ); System out,println( "price ="+ price); Systen out, printlo( "occasion = " occasion ); Systed out roriatios "taxable ="+ taxable ) 41. We are coding the following inside the class Gift; where is the error? public boolean equals( Object g ) \{ return ( this =9 )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
