Question

Create a program to help some local coffee shops manage their menus Requirements The class contains: 1) A method called defau

program is C#

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

Note: Done as asked. Comment for any help.Please uprate.

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace localCoffeeShops
{
    class Program
    {
        static List<string> defaultMenu()
        {
            string[] coffees={ "Coffee", "Americano", "Cappucino" };
            List<string> defaultMenuList = new List<string>(coffees);
            return defaultMenuList;
        }
        static List<string> customMenu(int totalItems)
        {
            List<string> customMenuList = new List<string>();
            string temp;
            Console.WriteLine("\nPlease give :" + totalItems+" items");
            for (int i = 0; i < totalItems; i++)
            {
                temp = Console.ReadLine();
                customMenuList.Add(temp);
            }
            return customMenuList;
        }
        static void printMenu(List<string> menu)
        {
            Console.WriteLine("\n######################");
            Console.WriteLine("\nItems in List :"+menu.Count);
            Console.WriteLine("\n######################");

            foreach (var str in menu)
            {
                Console.WriteLine(str);
            }
        }
        static void Main(string[] args)
        {
            List<string> defaultMenuList = new List<string>();
            List<string> customMenuList = new List<string>();
            Console.WriteLine("\nDefault List Original");
            defaultMenuList = defaultMenu();
            printMenu(defaultMenuList);
            Console.WriteLine("\nDefault List After removing Americano");
            defaultMenuList.Remove("Americano");
            printMenu(defaultMenuList);

            Console.WriteLine("Please create custom list ");
            customMenuList = customMenu(3);
            Console.WriteLine("Original Custom List");
            printMenu(customMenuList);

            Console.WriteLine("\nCustom List after adding an element");
            customMenuList.Add("Newly Added");
            printMenu(customMenuList);
            Console.ReadKey();
        }
    }
}

Output:

file:///c:/users/computer science/documents/visual studio Default List Original Items in List :3 Coffee Americano Cappucino D

Add a comment
Know the answer?
Add Answer to:
Create a program to help some local coffee shops manage their menus Requirements The class contai...
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
  • Design a restaurant class to help manage multiple restaurants and their menus equiremen The class...

    program is C# Design a restaurant class to help manage multiple restaurants and their menus equiremen The class contains: 1) A static int variable named storeCounter that starts at 1 and increments for each new restaurant item that is created 2) A string array called Menu 3) An int variable called StoreID 4) A Boolean variable called isOpen 5) A no-argument constructor that performs the following a. Sets storelD to storeCounter, then increments storeCounter b. Sets isOpen to true c....

  • Your assignment is to create a restaurant ordering system where the cashier can create the menu...

    Your assignment is to create a restaurant ordering system where the cashier can create the menu and then take in the order and display the order back to the customer Sample Execution – Level 1 Welcome to your Menu Creation system. How many items would you like to have on your menu? 2 Create your menu! Enter item #1: Coffee Enter item #2: Tea This is the menu: Coffee Tea What would you like to order? Cake That isn’t on...

  • This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program).

    Ch 7 Program: Online shopping cart (continued) (Java)This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program).(1) Extend the ItemToPurchase class per the following specifications:Private fieldsstring itemDescription - Initialized in default constructor to "none"Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt)Public member methodssetDescription() mutator & getDescription() accessor (2 pts)printItemCost() - Outputs the item name followed by the quantity, price, and subtotalprintItemDescription() - Outputs the...

  • 8.7 LAB*: Program: Online shopping cart (Part 2)

    8.7 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 first saving your earlier program).(1) Extend the ItemToPurchase class per the following specifications:Private fieldsstring itemDescription - Initialized in default constructor to "none"Parameterized...

  • Language : JAVA Part A Create a class CompanyDoc, representing an official document used by a...

    Language : JAVA Part A Create a class CompanyDoc, representing an official document used by a company. Give it a String title and an int length. Throughout the class, use the this. notation rather than bare instance variables and method calls.   Add a default constructor. Add a parameterized constructor that takes a value for title. Use this( appropriately to call one constructor from another. Add a toString(), which returns a string with the title, and the length in parentheses. So...

  • Adv. Java program - create a math quiz

    Create a basic math quiz program that creates a set of 10 randomly generated math questions for the following operations:AdditionSubtractionMultiplicationDivisionModuloExponentThe following source files are already complete and CANNOT be changed:MathQuiz.java (contains the main() method)OperationType.java (defines an enumeration for valid math operations and related functionality)The following source files are incomplete and need to be coded to meet the indicated requirements:MathQuestionable.javaA Random object called RANDOM has already been declared and assigned, and you must not change this assignment in any way.Declare and assign an interface integer called MAX_SMALL and assign it the...

  • Can you help with the merge method? This method should create and return an ArrayBagcontaining one...

    Can you help with the merge method? This method should create and return an ArrayBagcontaining one occurrence of any item that is found in either the called object or the parameter other. For full credit, the resulting bag should not include any duplicates. Give the new ArrayBag a maximum size that is the sum of the two bag’s maximum sizes. import java.util.*; /** * An implementation of a bag data structure using an array. */ public class ArrayBag { /**...

  • 4.18 Ch 7 Program: Online shopping cart (continued) (C++) This program extends the earlier "Online shopping...

    4.18 Ch 7 Program: Online shopping cart (continued) (C++) This program extends the earlier "Online shopping cart" program. (solution from previous lab assignment is provided in Canvas). (1) Extend the ItemToPurchase class per the following specifications: Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt) Public member functions SetDescription() mutator & GetDescription() accessor (2 pts) PrintItemCost() - Outputs the item name followed by the quantity, price, and subtotal PrintItemDescription() -...

  • Part I: Create a doubly linked circular list class named LinkedItemList that implements the following interface:...

    Part I: Create a doubly linked circular list class named LinkedItemList that implements the following interface: /** * An ordered list of items. */ public interface ItemList<E> {      /**       * Append an item to the end of the list       *       * @param item – item to be appended       */ public void append(E item);      /**       * Insert an item at a specified index position       *       * @param item – item to be...

  • python code? 1. Create a class called Person that has 4 attributes, the name, the age,...

    python code? 1. Create a class called Person that has 4 attributes, the name, the age, the weight and the height [5 points] 2. Write 3 methods for this class with the following specifications. a. A constructor for the class which initializes the attributes [2.5 points] b. Displays information about the Person (attributes) [2.5 points] c. Takes a parameter Xage and returns true if the age of the person is older than Xage, false otherwise [5 points] 3. Create another...

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
ADVERTISEMENT