Question

The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go....

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 child’s meal. Write a program that accepts the number of each type of meal ordered and display the total money collected for adult meals, children’s meals, and all meals. Save the program as ChiliToGo.java.

Must be using JOption.

Thanks!

Homework Answers

Answer #1

For the above program, we need to have the following things into consideration.

  1. First, we need to take input for the two meals
  2. Then we need to calculate the cost of individual meals cost.
  3. Then we need to find the total cost of the meals

Following is the code in java.

import java.util.Scanner;

public class ChillToGo {
   public static void main(String args[]) {
       Scanner scan = new Scanner(System.in);
       System.out.print("Adult's Meals: ");
       int adult_meals = scan.nextInt();
       System.out.print("Child's Meals: ");
       int child_meals = scan.nextInt();
      
       int adult_meals_cost = adult_meals*7;
       int child_meals_cost = child_meals*4;
      
       System.out.println("Cost of Adult Meals: " + adult_meals_cost);
       System.out.println("Cost of Child Meals: " + child_meals_cost);
       System.out.println("Total Cost: " + (adult_meals_cost + child_meals_cost));
      
   }

}

Following is the snippet of the program output.

That was a nice question to answer
Friend, If you have any doubts in understanding do let me know in the comment section. I will be happy to help you further.
Please like if you think effort deserves like.
Thanks

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT
Active Questions
  • 4. List and describe the THREE (3) necessary conditions for complete similarity between a model and...
    asked 17 minutes ago
  • In C++ Complete the template Integer Average program. // Calculate the average of several integers. #include...
    asked 22 minutes ago
  • A uniform rod is set up so that it can rotate about a perpendicular axis at...
    asked 24 minutes ago
  • To the TwoDArray, add a method called transpose() that generates the transpose of a 2D array...
    asked 45 minutes ago
  • How could your result from GC (retention time, percent area, etc.) be affected by these following...
    asked 55 minutes ago
  • QUESTION 17 What are the tasks in Logical Network Design phase? (Select five. ) Design a...
    asked 57 minutes ago
  • What is the temperature of N2 gas if the average speed (actually the root-mean-square speed) of...
    asked 1 hour ago
  • Question One: Basic security concepts and terminology                         (2 marks) Computer security is the protection of...
    asked 1 hour ago
  • In program P83.cpp, make the above changes, save the program as ex83.cpp, compile and run the...
    asked 1 hour ago
  • the determination of aspirin in commercial preparations experment explain why the FeCl3-KCl-HCl solution was ased as...
    asked 1 hour ago
  • Describe important events and influences in the life of Wolfgang Amadeus Mozart. What styles, genres, and...
    asked 1 hour ago
  • 3.12 Grade Statistics Write a python module "school.py" that prints school information (first 3 lines of...
    asked 1 hour ago