Create a C# console application with the name ManageRestaurants. Rename Program.cs as Restaurant.cs. Add the below code
Restaurant.cs
using System;
namespace ManageRestaurants
{
class Restaurant
{
//class variables
private static int
storeCounter = 1;
private string[]
Menu;
private int
StoreID;
private Boolean
isOpen;
//no-argument
constructor
public
Restaurant()
{
//set the store id
StoreID = storeCounter;
// increment the storeCounter
storeCounter++;
//set isOpen to true
isOpen = true;
//set the menu size to 3
Menu = new string[3];
}
//constructor with
paramters
public Restaurant(int
iParam, Boolean bParam)
{
//set the store id
StoreID = storeCounter;
// increment the storeCounter
storeCounter++;
//set isOpen
isOpen = bParam;
//set the menu size
Menu = new string[iParam];
}
//method that sets
the Menu
public void
setMenu(String[] menuItems)
{
//set the menu items
Menu = menuItems;
}
/* Use this method if
you want to take menu items from the user
* public void
setMenu()
{
for(int i = 0; i < Menu.Length; i++)
{
Console.Write("Enter Menu Item #" + i + ": ");
Menu[i] = Console.ReadLine();
}
}*/
//method that sets
first three items of the menu
public void
setMenuEasy()
{
Menu[0] = "Hamburger";
Menu[1] = "Hot dog";
Menu[2] = "Pizza";
}
//method that prints
the restaurant details
public void
restaurantDetails()
{
//print the store id
Console.WriteLine("StoreID: " + StoreID);
//print the menu items
Console.WriteLine("Menu: ");
for (int i = 0; i < Menu.Length; i++)
{
Console.WriteLine((i + 1) + ". " + Menu[i]);
}
//print whether the restaurant is open or not
if (isOpen)
Console.WriteLine("The Restaurant is Open.");
else
Console.WriteLine("The Restaurant is Closed.");
Console.WriteLine();
}
static void
Main(string[] args)
{
// create 3 new Restaurants
// one with default constructor
Restaurant r1 = new Restaurant();
// second with open and menu size 4
Restaurant r2 = new Restaurant(4, true);
// third with closed and menu size 3
Restaurant r3 = new Restaurant(3, false);
// call setMenuEasy for 1st and 3rd restaurant
r1.setMenuEasy();
r3.setMenuEasy();
// call setMenu for 2nd restaurant
String[] items = { "Pizza", "Burger", "Pasta" };
r2.setMenu(items);
//print the restaurant details of all the restaurants
r1.restaurantDetails();
r2.restaurantDetails();
r3.restaurantDetails();
Console.ReadLine();
}
}
}
Output:
Program Screenshot:
Let me know if you have any concerns with the above solution.
Design a restaurant class to help manage multiple restaurants and their menus equiremen The class...
program is C# Create a program to help some local coffee shops manage their menus Requirements The class contains: 1) A method called defaultMenu that returns a String list and has no parameters. When called, the method returns a string list containing the following elements: {"Coffee", "Americano", Cappuccino" A method called custom Menu that returns a String list and has an int parameter. When called, the method will create a new string list, then ask the user for items to...
Create a class called Restaurant that is the base class for all restaurants. It should have attributes for the restaurant's name{protected) and seats (private attribute that represents the number of seats inside the restaurant). Use the UML below to create the methods. Note, the toString prints the name and the number of seats. Derive a class Fastfood from Restaurant This class has one attribute - String slogan (the slogan that the restaurants uses when advertising - e.g., "Best Burgers Ever!")....
Code should be in C# Create a class called SavingsAccount. Use a static variable called annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12 – this interest should be added to savingsBalance. Provide static method setAnnualInterestRate to set the annualInterestRate to a new value....
Additional info is this will use a total of four classes Book, BookApp, TextBook, and TextBookApp. Also uses Super in the TextBook Class section. Problem 1 (10 points) Вook The left side diagram is a UML diagram for Book class. - title: String The class has two attributes, title and price, and get/set methods for the two attributes. - price: double Вook) Book(String, double) getTitle(): String setTitle(String): void + getPrice() double setPrice(double): void toString() String + The first constructor doesn't...
Application should be in C# programming language Create a class called SavingsAccount. Use a static variable called annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12 – this interest should be added to savingsBalance. Provide static method setAnnualInterestRate to set the...
java problem here is the combination class class Combination { int first,second,third, fourth; public Combination(int first, int second, int third,int fourth) { this.first=first; this.second=second; this.third=third; this.fourth=fourth; } public boolean equals(Combination other) { if ((this.first==other.first) && (this.second==other.second) && (this.third==other.third) && (this.fourth==other.fourth)) return true; else return false; } public String toString() { ...
fisrt one is bicycle.java second code is bicycleapp.java can anyone help this??? please save my life Before you begin, DOWNLOAD the files “Lab8_Bicycle.java” and “Lab8_BicycleApp.java” from Canvas to your network drive (not the local hard drive or desktop). Once you have the files saved, RENAME THE FILES Bicycle.java and BicycleApp.java then open each file. 1) Look at the Bicycle class. Two of the many data properties we could use to define a bike are its color and the gear it...
Using an appropriate definition of ListNode, design a simple linked list class called StringList with the following member functions: void add (std::string); int positionOf (std::string); bool setNodeVal(int, std::string); std::vector<std::string> getAsVector(); a default constructor a copy constructor a destructor The add() function adds a new node containing the value of the parameter to the end of the list. The positionOf() function returns the (zero-based) position in the list for the first occurrence of the parameter in the list, or -1 if...
Please help me with this code. Thank you Implement the following Java class: Vehicle Class should contain next instance variables: Integer numberOfWheels; Double engineCapacity; Boolean isElectric, String manufacturer; Array of integers productionYears; Supply your class with: Default constructor (which sets all variables to their respective default values) Constructor which accepts all the variables All the appropriate getters and setters (you may skip comments for this methods. Also, make sure that for engineCapacity setter method you check first if the vehicle...
public class Fish { private String species; private int size; private boolean hungry; public Fish() { } public Fish(String species, int size) { this.species = species; this.size = size; } public String getSpecies() { return species; } public int getSize() { return size; } public boolean isHungry() { return hungry; } public void setHungry(boolean hungry) { this.hungry = hungry; } public String toString() { return "A "+(hungry?"hungry":"full")+" "+size+"cm "+species; } }Define a class called Lake that defines the following private...