Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS1 Decisions 85- and 100-Point Versions Lab West Burgers Problem Description You are to write a program that calculates the cost of a fast food

CS1 Decisions 85- and 100-Point Versions Lab West Burgers Problem Description You are to write a program that calculates the cost of a fast food order given the combo number that is ordered, whether or not the order is being super-sized, and the number of cookies ordered. The table below shows the charges for each of the 4 combos that can be ordered, the cost for super-sizing, and the cost per cookie. Item Ordered Cost Combo 1 $ 3.99 Combo 2 $ 4.59 Combo 3 $ 5.29 Combo 4 $ 7.49 Super-Size $ 1.50 Cookie $ 1.25

this is what I have so far:

/*

*Jayne smith

*01/12/2023

*West Burgers

*/

import java.util.Scanner;

public class WestBurgers

{

public static void main(String[] args)

{

// Input the customer's name, combo ordered,

// whether or not the order is to be super-sized, and

// the number of cookies ordered.

Scanner scan = new Scanner(System.in);

System.out.print("Enter customer name:");

String name = scan.nextLine();

System.out.print("Enter combo ordered:");

int combo = scan.nextInt();

System.out.print("Do you want to supersize your order?");

String SuperSized = scan.next();

System.out.print("Number of cookies:");

int cookies = scan.nextInt();

if (combo >= 1 && combo <= 4)

{

double cost = calcCost(combo, SuperSized, cookies);

System.out.printf(name + "owes $%.2f ", cost);

}

else

{

System.out.println("Invalid combo number. Rerun program.");

}

System.out.println();

if (cookies >= 1)

{

double cost = cookies*1.25 ;

}

if (SuperSized == yes)

{ double cost = combo + 1.50;

}

}

/** Calculate the cost of a fast food order given the combo ordered,

* whether or not the order is to be super-sized, and the number

* of cookies ordered.

* @param comboNum the combo orderd

* @param isSuperSized string containing "yes" if this to be super-sized

* @param numCookies the number of cookies ordered

* @return the cost of the food order

*/

public static double calcCost(int comboNum, String isSuperSized, int numCookies)

{ final double comboNum1_COST = 3.99;

final double comboNum2_COST = 4.59;

final double comboNum3_COST = 5.29;

final double comboNum4_COST = 7.49;

final double SUPERSIZED_COST = 1.50;

final double numCookies_COST = 1.25;

double cost = comboNum + SUPERSIZED_COST + numCookies;

// Replace this statement with your code to calculate the cost and

// return the variable holding the final cost

return cost;

}

}

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions