Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the OrderApp program below that uses the getCost() method to calculate the cost for some number of t-shirts, hoodies, or shorts. There is a

  • Complete the OrderApp program below that uses the getCost() method to calculate the cost for some number of t-shirts, hoodies, or shorts. There is a $6.00 surcharge for each size x-large item.
    • Here is the expected output for the program:

$ java OrderApp

5 t-shirts, size medium: $50.00

2 hoodies, size x-large: $72.00

3 shorts, size small: $45.00

  • Here is the program that you must complete using the provided enumerations and class constants:

import java.util.*;

public class OrderApp {

public enum Size {SMALL, MEDIUM, LARGE, XLARGE}

public enum Item {TSHIRT, HOODIE, SHORTS}

public static final int TSHIRT_COST = 10;

public static final int HOODIE_COST = 30;

public static final int SHORTS_COST = 15;

public static final int XLARGE_SURCHARGE = 6;

public static void main(String[] args) {

System.out.println(" 5 t-shirts, size medium: $" + getCost(/* Add Code Here */) + ".00"); System.out.println(" 2 hoodies, size x-large: $" + getCost(/* Add Code Here */) + ".00"); System.out.println(" 3 shorts, size small: $" + getCost(/* Add Code Here */) + ".00"); } public static int getCost(Item i, Size s, int number) {

//Add code here } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Copy and complete the statement. 3800 m ? km =

Answered: 1 week ago