Home / Expert Answers / Computer Science / what-is-displayed-by-the-following-code-segment-public-class-book-private-double-cost-retail-pa925

(Solved): What is displayed by the following code segment? public class Book \{ private double cost, retail; ...



What is displayed by the following code segment?
public class Book \{
private double cost, retail;
private boolean fiction;
p

What is displayed by the following code segment? public class Book \{ private double cost, retail; private boolean fiction; private void setRetail() \{ if(fiction) retail \( =\cos t * 2.0 \) else retail \( =\cos t * 1.5 \); \} public Book(double \( c \), boolean \( f)\{ \) \( \cos t=c \); fiction \( =\mathbf{f} ; \) retail \( =\cos t \) \} public double getRetail() \{ setRetail(); return retail; \} public static void main(String[] args) \{ Book myBook \( = \) new \( \operatorname{Book}(10.0 \), true \( ) \); System. out. println(myBook. getRetail()); 3 //rest of file not shown... Select one A. \( 12.0 \) B. \( 18.0 \) C. \( 24.0 \) D. none of these


We have an Answer from Expert

View Expert Answer

Expert Answer


For the given Book
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe