A novice programmer trying to complete a Restauran Menu Calculator in Visual C# 2010

  • Thread starter Thread starter TheJoker1990
  • Start date Start date
T

TheJoker1990

Guest
Hi, I need to create an application that can be used in a restaurant to calculate a table’s bill. The program should display all the menu items from the table below in 4 Combo boxes. There are 4 categories of food offered which are Beverage, Appetizer, Main Course and Desert. Each Combo box should carry one of the food categories. The user can choose from the Combo box to add an item to a table’s bill. When each item is selected from the Combo box, the item price will be added to the bill. The Clear Bill button allows user to reset the Subtotal, Tax and Total to 0.Use 10% as the tax rate. To answer any future questions, Yes it is a school assignment and No i dont expect anybody to do the assignment for me. I already did part of the code or all of it, I am no really sure since I am just coding what i had learn so far in class and by reading the textbook. My question is what do i need to do next if anything, I debug the code already and it does compile, the menu items appear on the combo boxes, but it doesnt give me the total and the clear bottom doesnt do anything, this is what i got so far:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void label1_Click(object sender, EventArgs e)
{

}

private void label2_Click(object sender, EventArgs e)
{

}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
}
public class Order
{
public String[] appetizers = new
string[] {"Buffalo Wings",
"Potato Skins",
"Nachos",
"Mushroom Caps"};

public string[] mainEntree = new
string[] {"Seafood Alfredo",
"Turkey Club",
"Lobster Pie",
"Prime Rib",
"Shrimp Scampi",
"Seafood Platter"};

public string[] dessertEntree = new
string[] {"Mud Pie",
"Apple Crisp",
"Carrot Cake",
"Raspberry Cheese Cake"};

public decimal[] appetizersPrice = new
decimal[] {5.95m, 8.95m, 6.95m,
9.95m, 11.95m};

public decimal[] mainEntreePrice = new
decimal[] {16.95m, 12.95m,
19.95m, 20.95m,
17.95m, 18.95m};

public decimal[] dessertEntreePrice = new
decimal[] {4.95m, 3.95m,
5.95m, 5.95m};

private string drink;
private string app;
private string main;
private string dessert;
private decimal drinkPrice;
private decimal appPrice;
private decimal mainPrice;
private decimal dessertPrice;

public Order()
{
drink = "";
app = "";
main = "";
dessert = "";
drinkPrice = 0;
appPrice = 0;
mainPrice = 0;
dessertPrice = 0;
}




public string App
{
get
{
return app;
}
set
{
app = value;
SetAppPrice();
}
}

public string Main
{
get
{
return main;
}
set
{
main = value;
SetMainPrice();
}
}

public string Dessert
{
get
{
return dessert;
}
set
{
dessert = value;
SetDessertPrice();
}
}

public string Drink
{
get
{
return drink;
}
set
{
drink = value;
SetDrinkPrice();
}
}

public decimal AppPrice
{
get
{
return appPrice;
}
}

public decimal MainPrice
{
get
{
return mainPrice;
}
}

public decimal DessertPrice
{
get
{
return dessertPrice;
}
}

public decimal DrinkPrice
{
get
{
return drinkPrice;
}
}

public void SetAppPrice()
{
for (int i = 0; i < appetizers.Length; i++)
{
if (appetizers == app)
{
appPrice = appetizersPrice;
}
}
}

public void SetMainPrice()
{
for (int i = 0; i < mainEntree.Length; i++)
{
if (mainEntree == app)
{
mainPrice = mainEntreePrice;
}
}
}

public void SetDessertPrice()
{
for (int i = 0; i < dessertEntree.Length; i++)
{
if (dessertEntree == app)
{
dessertPrice = dessertEntreePrice;
}
}
}

public void SetDrinkPrice()
{
switch (drink)
{
case "Soda":
drinkPrice = 1.95m;
break;
case "Tea":
drinkPrice = 1.50m;
break;
case "Coffee":
drinkPrice = 1.25m;
break;
case "Mineral Water":
drinkPrice = 2.95m;
break;
}
}

public decimal Total()
{
return appPrice + mainPrice + dessertPrice + drinkPrice;
}
}
}
}





Continue reading...
 
Back
Top