IN C#
Write a program to help a local restaurant automate its lunch billing system. The program should do the following:
Ham and Cheese Sandwich |
$5.00 |
|
Tuna Sandwich |
$6.00 |
|
Soup of the Day |
$2.50 |
|
Baked Potato |
$3.00 |
|
Salad |
$4.75 |
|
Chips |
$2.00 |
|
French Fries |
$1.75 |
|
Bowl of Fruit |
$2.50 |
Welcome to Bob’s Restaurant:
Ham and Cheese Sandwich |
$5.00 |
|
Chips |
$2.00 |
|
Tax |
$0.35 |
|
Total |
$7.35 |
Your program must have the following:
/* Source code*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace lunch_billing__system
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
static string[] itemName = { "HamChess Sandwich", "Tuna
Sandwich", "Soup of the Day", "Backed Potato", "Salad", "Chips",
"French Fries", "Bowl of Fruit" };
static double[] itemPrice = { 5.00, 6.00, 2.50, 3.00, 4.75, 2.00,
1.75, 2.50 };
static int n = itemName.Length;
TextBox[] textBoxes;
Label[] labelsName;
Label[] labelsPrice;
static bool isValidInput = true;
private void Form1_Load(object sender, EventArgs e)
{
textBoxes = new TextBox[n];
labelsName = new Label[n];
labelsPrice = new Label[n];
int totalItem = itemName.Length;
Label Header = new Label();
Header.Location = new Point(10, 10);
this.Controls.Add(Header);
for (int i=0;i<totalItem;i++)
{
labelsName[i] = new Label();
labelsPrice[i] = new Label();
labelsName[i].Text = itemName[i];
textBoxes[i] = new TextBox();
labelsName[i].Location = new Point(10, 30 * (i + 1));
textBoxes[i].Location = new Point(130, 30 * (i + 1));
labelsPrice[i].Text = "$" + itemPrice[i].ToString();
labelsPrice[i].Location = new Point(250, 30 * (i + 1));
this.Controls.Add(labelsName[i]);
this.Controls.Add(textBoxes[i]);
this.Controls.Add(labelsPrice[i]);
}
Button btn = new Button();
btn.Text = "Save";
btn.Location = new Point(120, (n+2) * 30);
this.Controls.Add(btn);
btn.Click += Btn_Click;
}
void doCalculation()
{
StringBuilder sb = new StringBuilder();
string s = "ItemName\tPrice\tQuantity\tTotalPrice\n";
double total = 0;
sb.Append(s);
for (int i = 0; i < n; i++)
{
int quantity = 0;
if (Int32.TryParse(textBoxes[i].Text.ToString(), out
quantity) && quantity>0) //check quantity should be
atleast 1
{
double currentPrice = (quantity * itemPrice[i]);
s = labelsName[i].Text.ToString() + "\t" +
labelsPrice[i].Text.ToString() + "\t" +
textBoxes[i].Text.ToString() + "\t" + currentPrice.ToString() +
"\n";
total += currentPrice;
sb.Append(s);
}
}
double tax = (total * 0.05);
s =
"--------------------------------------------------------------------\nTax(5%):"
+ "\t\t" + tax + "\n";
sb.Append(s);
s = "Total : " + (total + tax);
sb.Append(s);
MessageBox.Show(sb.ToString());
}
private void Btn_Click(object sender, EventArgs e)
{
doCalculation();
}
}
}
/* Editor screen*/
/* Output screen*/
/* Form design*/
/* NOTE There is nothing in form design. Since controls are added dynamically based on item and calucaltion are done accordingly*/
/* Please run and see the output*/
/* Thanks for thumbs up :) */
IN C# Write a program to help a local restaurant automate its lunch billing system. The...
c++ Write a C++ program using the struct keyword to help a local restaurant automate its breakfast billing system The program should do the following: a. Show the customer the different breakfast items offered by the restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item) Menu Plain...
Write a program to help a local restaurant automate its breakfast billing system. The program should do the following:Show the customer the different breakfast items offered by the restaurant.Allow the customer to select more than one item from the menu.Calculate and print the bill.Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item):Use an array menuList of type menuItemType, as defined in Programming Exercise 3. Your program must contain at least the...
In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Name Price Egg (cooked to order)...
For my assignment I have to write a program that creates a restaurant billing system. I think that I got it correct but it says that it is incorrect, so I was wondering if someone would be able to look over my code. It says that I need tax of $0.20, and the amount due to be $4.10, which is what I have in my output.https://imgur.com/a/jgglmvWMy issue is that I have the correct outcome when I run my program but...
#include <iostream> #include <iomanip> #include <vector> #include <string> using namespace std; struct menuItemType { string menuItem; double menuPrice; }; void getData(menuItemType menuList[]); void showMenu(menuItemType menuList[], int x); void printCheck(menuItemType menuList[], int menuOrder[], int x); int main() { const int menuItems = 8; menuItemType menuList[menuItems]; int menuOrder[menuItems] = {0}; int orderChoice = 0; bool ordering = true; int count = 0; getData(menuList); showMenu(menuList, menuItems); while(ordering) { cout << "Enter the number for the item you would\n" << "like to order, or...
Problem 1: Dynamic Grocery Array Using Java to write a program that prompts the user to enter an item’s name for each position in the array. The program then prints uses a loop to output the array. Example 1: Banana 2: Orange 3: Milk 4: Carrot 5: Chips Banana, Orange, Milk, Carrot, Chips Problem 2: Print Characters in String Array Declare a string array of size 5. Prompt the user enters five strings that are stored in the array....
I am struggling with a program in C++. it involves using a struct and a class to create meal arrays from a user. I've written my main okay. but the functions in the class are giving me issues with constructors deconstructors. Instructions A restaurant in the Milky way galaxy called “Green Alien” has several meals available on their electronic menu. For each food item in each meal, the menu lists the calories per gram and the number of grams per...
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...
c++ The program will be recieved from the user as input name of an input file and and output.file. then read in a list of name, id# and score from input file (inputFile.txt) and initilized the array of struct. find the student with the higher score and output the students info in the output file obtain the sum of all score and output the resurl in output file. prompt the user for a name to search for, when it find...