Here's a Java program named ChilisToGo.java that calculates the total money collected for adult meals, children’s meals, and all meals based on the number of each meal ordered:
The Java Program
import java.util.Scanner;
public class ChilisToGo {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Accept the number of adult and child meals ordered
System.out.print("Enter the number of adult meals ordered: ");
int adultMeals = input.nextInt();
System.out.print("Enter the number of child's meals ordered: ");
int childMeals = input.nextInt();
// Calculate the total money collected for adult meals, children’s meals, and all meals
double adultTotal = adultMeals * 7;
double childTotal = childMeals * 4;
double totalCollected = adultTotal + childTotal;
// Display the total money collected for each type of meal and overall
System.out.println("Total money collected for adult meals: $" + adultTotal);
System.out.println("Total money collected for children's meals: $" + childTotal);
System.out.println("Total money collected for all meals: $" + totalCollected);
input.close();
}
}
This program prompts the user to enter the number of adult meals and children's meals ordered, calculates the total money collected for each meal type and overall, and displays the results accordingly.