Question

Problem 1: Selecting Menus You need to know what to order for your dinner party, they...

Problem 1: Selecting Menus

You need to know what to order for your dinner party, they return a card that has an appetizer, the main dish, and the desert that they would like to have for their meal. The following is the list of appetizers sent to guests from which they choose their selection:

Escargots a la Bourguignonne

Provençal Stuffed Squid

Duck Pâté en Croûte

Black Olive Tapenade (vegan)

Tartare de Filet de Boeuf

For each of appetizers users enter how many of each dish is needed for the party.

For example: “Your appetizer menu is the following.

1. Escargots a la Bourguignonne 0

2. Provençal Stuffed Squid 0

3. Duck Pâté en Croûte 0

4. Black Olive Tapenade (vegan) 0

5. Tartare de Filet de Boeuf 0

Choose an number item to enter the quantity of appetizers needed or -1 to end: 1

Enter the number of Escargots a la Bourguignonne needed: 3

Your appetizer menu is the following.

1. Escargots a la Bourguignonne 3

2. Provençal Stuffed Squid 0

3. Duck Pâté en Croûte 0

4. Black Olive Tapenade (vegan) 0

5. Tartare de Filet de Boeuf 0

Choose an number item to enter the quantity of appetizers needed or -1 to end: -1

You should use arrays for purposes of storing the information needed by this program. You should have a minimum of one method. Your methods should have proper Javadoc describing your methods in addition to the internal commenting and other design aspects of your code. You can assume users will enter numbers, but your program should handle the situation where a number outside of the range is entered.

IN JAVA.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE FOR THE PROGRAM IN JAVA:-

import java.util.Scanner;
public class Main

{
static Scanner Obj = new Scanner(System.in); //Scanner object
// Method
static void myMethod(int choice,int count[]) { //choice to store user choice and count to count the dishes.
switch (choice) {
case 1:
System.out.println("Enter the number of Escargots a la Bourguignonne needed ");
count[0]+=Obj.nextInt();
break;
case 2:
System.out.println("Enter the number of Provençal Stuffed Squid needed ");
count[1]+=Obj.nextInt();
break;
case 3:
System.out.println("Enter the number of Duck Pâté en Croûte needed ");
count[2]+=Obj.nextInt();
break;
case 4:
System.out.println("Enter the number of Black Olive Tapenade needed ");
count[3]+=Obj.nextInt();
break;
case 5:
System.out.println("Enter the number of Tartare de Filet de Boeuf needed ");
count[4]+=Obj.nextInt();
break;
default:
System.out.println("INVALID INPUT!!!");
}
}
   public static void main(String[] args) {
  
   int[] count = new int[]{ 0,0,0,0,0}; // declaring count array
  
   //array dishes to store the dishes user can order
   String[] dishes = {"scargots a la Bourguignonne", "Provençal Stuffed Squid", "Duck Pâté en Croûte",
   "Black Olive Tapenade (vegan)","Tartare de Filet de Boeuf"};
       System.out.println("Your appetizer menu is the following");
       System.out.println("1. Escargots a la Bourguignonne "+count[0]);
       System.out.println("2. Provençal Stuffed Squid "+count[1]);
       System.out.println("3. Duck Pâté en Croûte "+count[2]);
       System.out.println("4. Black Olive Tapenade (vegan) "+count[3]);
       System.out.println("5. Tartare de Filet de Boeuf "+count[4]);
  
       System.out.println("Choose an number item to enter the quantity of appetizers needed or -1 to end:");
       int choice = Obj.nextInt();
       while(choice!=-1){ // Program will terminate if user will enter -1
      
       myMethod(choice,count); //Calling the method
      
//for loop to print the dishes with their respective counts
for (int i = 0; i < dishes.length; i++) {
System.out.println(dishes[i]+" "+count[i]);
}
System.out.println("Choose an number item to enter the quantity of appetizers needed or -1 to end:");
       choice = Obj.nextInt();
}
   }
}

SCREENSHOT OF THE PROGRAM:-

SAMPLE OUTPUT:

HAPPY LEARNING.

Add a comment
Know the answer?
Add Answer to:
Problem 1: Selecting Menus You need to know what to order for your dinner party, they...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need java code for both questions..thx > Problem 1 U As you know the ber of...

    Need java code for both questions..thx > Problem 1 U As you know the ber of days in achthof our ca . Forway 2 days in a year, or days other • April S a d November 30 days. • All other s ide y that are divisie by deg 200 2012, 2016) How the years that are dividely 100 g 2100, 2200) e t lap years. But there's a lot ption years that are dive ly 400 ... 1600,...

  • Need three seperate files. ShoppingCartManager.java ShoppingCart.java ItemsToPurchase.java These are from part 1 what do you mean...

    Need three seperate files. ShoppingCartManager.java ShoppingCart.java ItemsToPurchase.java These are from part 1 what do you mean by deep study 7.25 LAB*: Program: Online shopping cart (Part 2) Note: Creating multiple Scanner objects for the same input stream yields unexpected behavior. Thus, good practice is to use a single Scanner object for reading input from System.in. That Scanner object can be passed as an argument to any methods that read input This program extends the earlier Online shopping cart program (Consider...

  • Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders...

    Overview JAVA LANGUAGE PROBLEM: The owner of a restaurant wants a program to manage online orders that come in. This program will require multiple classes. Summary class, customer class, order class and the driver class. Summary class This class will keep track of the cost of the order and output a summary, which includes the total for the order. The methods in this class are static. There are no instance variables, and instead uses an Order object that is passed...

  • (2 bookmarks) In JAVA You have been asked to write a program that can manage candidates...

    (2 bookmarks) In JAVA You have been asked to write a program that can manage candidates for an upcoming election. This program needs to allow the user to enter candidates and then record votes as they come in and then calculate results and determine the winner. This program will have three classes: Candidate, Results and ElectionApp Candidate Class: This class records the information for each candidate that is running for office. Instance variables: first name last name office they are...

  • Problem Statement: A company intends to offer various versions of roulette game and it wants you...

    Problem Statement: A company intends to offer various versions of roulette game and it wants you to develop a customized object-oriented software solution. This company plans to offer one version 100A now (similar to the simple version in project 2 so refer to it for basic requirements, but it allows multiple players and multiple games) and it is planning to add several more versions in the future. Each game has a minimum and maximum bet and it shall be able...

  • In Diet & Wellness Plus you will create the below profile and add the foods below....

    In Diet & Wellness Plus you will create the below profile and add the foods below. You will then pull Reports and answer the questions. Topic: Dietary Reference Intakes (DRIs) Menu: Sample 2,000 calorie menu (from MyPlate) DWP Reports Used Intake vs. Goals MyPlate Analysis Go to Diet & Wellness Plus and create the following profile for Reuben Ward. Birth Date: May 7, 1998 (Note: adjust the date of birth on this assignment so that Reuben is 19 years old...

  • Need this in C The starter code is long, if you know how to do it...

    Need this in C The starter code is long, if you know how to do it in other way please do. Do the best you can please. Here's the starter code: // ----------------------------------------------------------------------- // monsterdb.c // ----------------------------------------------------------------------- #include #include #include // ----------------------------------------------------------------------- // Some defines #define NAME_MAX 64 #define BUFFER_MAX 256 // ----------------------------------------------------------------------- // Structs typedef struct { char name[NAME_MAX]; int hp; int attackPower; int armor; } Character; typedef struct { int size; Character *list; } CharacterContainer; // ----------------------------------------------------------------------- //...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

  • Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an...

    Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an order at a fast-food burger joint. This class will be used in Part B, when we work with a list of orders. As vou work through this part and Part B, draw a UML diagram of each class in using the UML drawing tool 1) Create a new Lab5TestProject project in Netbeans, right-click on the lab5testproject package and select New>Java Class 2) Call your...

  • Can you please provide the formula for the worksheet also. CASE PROBLEMS Level 1- Analyzing Sales...

    Can you please provide the formula for the worksheet also. CASE PROBLEMS Level 1- Analyzing Sales for Crèmes Ice Cream Judd Hemming is the eastern regional marketing manager for Crèmes Ice Cream. Eac quarter, he completes two separate analyses: an analysis comparing ice cream flavor sale volumes from all regional locations with the same quarter sales volumes from the previou year and an analysis comparing total sales in dollars, including mean, median, mode, and standard deviation, of sales by store....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT