Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!