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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started