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 RestourantMenu
{
public partial class Form1 : Form
{
private float subtotal = 0;
private float tax = 0;
private float tips = 0;
private float total = 0;
private int peopleCount = 0;
private bool fifteenthPercentToTips = false;
public Form1()
{
InitializeComponent();
}
private void ButtonAddToBillTable_Click(object sender, EventArgs e)
{
if (treeViewFood.SelectedNode.Parent != null)
listBoxTableBill.Items.Add(treeViewFood.SelectedNode.Text);
}
private void ButtonClear_Click(object sender, EventArgs e)
{
textBoxSubtotal.Text = "0.00$";
textBoxTax.Text = "0.00$";
textBoxTips.Text = "0.00$";
textBoxTotal.Text = "0.00$";
}
private void ButtonEnterPeopleCount_Click(object sender, EventArgs e)
{
if (Int16.TryParse(textBoxPeopleCount.Text, out short n))
{
peopleCount = n;
if (peopleCount <= 6)
{
textBoxTipsCount.Enabled = true;
buttonTipsCount.Enabled = true;
}
else
fifteenthPercentToTips = true;
}
else
{
MessageBox.Show("Write correct number of people in party!");
textBoxTipsCount.Enabled = false;
buttonTipsCount.Enabled = false;
fifteenthPercentToTips = false;
}
}
private void ButtonTipsCount_Click(object sender, EventArgs e)
{
if (float.TryParse(textBoxTipsCount.Text.Replace('.',','), out float n))
{
tips = n;
textBoxTips.Text = tips.ToString("0.00") +"$";
}
else
MessageBox.Show("Write correct value of tips!");
}
}
}Please submit your question as order to get the full Visual Studio project.