Question
The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go. The price is $7 for an adult meal and
The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go. The price is $7 for an adult meal and $4 for a childs meal. Write a program that accepts the number of adult meals ordered and then children's meals ordered. Display the total money collected for adult meals, childrens meals, and all meals.
This is what I have but it is not correct at all:
import java.util.Scanner; class ChiliToGo { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter the number of child meals: "); int childMeals = in.nextInt(); System.out.print("Enter the number of adult meals: "); int adultMeals = in.nextInt();
double childMealsPrice = childMeals * 4; double adultMealsPrice = adultMeals * 7;
System.out.println("Total price of child meals = $" + childMealsPrice); System.out.println("Total price of adult meals = $" + adultMealsPrice); System.out.println("Total amount = $" + (childMealsPrice + adultMealsPrice)); } } This is what is it wants:
Input:
10
5
Expected Output
70.0, 20.0, 90.0
Input:
53
20
Expected Output
371.0, 80.0, 451.0
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