Question: Visual C# chapter 8 programming problem 11 I can not seem to get it to display the correct dollar amount, drink left amount or the
Visual C# chapter 8 programming problem 11 I can not seem to get it to display the correct dollar amount, drink left amount or the total sales. Here is what I have 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.Threading.Tasks; using System.Windows.Forms;
namespace Drink_Vending_Machine { struct Drinks { public string drinkName; public double drinkCost; public int no_Of_Drinks_In_Machine; } public partial class DrinkVendingMachine : Form { double total = 0.00; Drinks[] Drink = new Drinks[5]; public DrinkVendingMachine() { InitializeComponent(); } private void DrinkVendingMachine_Load_1(object sender, EventArgs e) { Drink[0].drinkName = "Cola"; Drink[0].drinkCost = 1.00; Drink[0].no_Of_Drinks_In_Machine = 20;
Drink[1].drinkName = "Root Beer"; Drink[1].drinkCost = 1.00; Drink[1].no_Of_Drinks_In_Machine = 20;
Drink[2].drinkName = "Lemon Lime"; Drink[2].drinkCost = 1.00; Drink[2].no_Of_Drinks_In_Machine = 20;
Drink[3].drinkName = "Grape Soda"; Drink[3].drinkCost = 1.50; Drink[3].no_Of_Drinks_In_Machine = 20;
Drink[4].drinkName = "Cream Soda"; Drink[4].drinkCost = 1.50; Drink[4].no_Of_Drinks_In_Machine = 20;
ColaPriceLabel.Text = Drink[0].drinkCost.ToString("c"); RootBeerPriceLabel.Text = Drink[1].drinkCost.ToString("c"); LemonLimePriceLabel.Text = Drink[2].drinkCost.ToString("c"); GrapeSodaPriceLabel.Text = Drink[3].drinkCost.ToString("c"); CreamSodaPriceLabel.Text = Drink[4].drinkCost.ToString("c");
ColaTextBox.Text = 20.ToString(); RootBeerTextBox.Text = 20.ToString(); LemonLimeTextBox.Text = 20.ToString(); GrapeSodaTextBox.Text = 20.ToString(); CreamSodaTextBox.Text = 20.ToString(); TotalTextBox.Text = 0.00.ToString(""); } private void ColaPictureBox_Click(object sender, EventArgs e) { if (Drink[0].no_Of_Drinks_In_Machine
private void DrinkVendingMachine_Load(object sender, EventArgs e) {
}
private void exitButton_Click_1(object sender, EventArgs e) { this.Close(); } } }

This is the design code





![: Form { double total = 0.00; Drinks[] Drink = new Drinks[5];](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3d8aa540df_74566f3d8a9b632b.jpg)

![Drink[0].drinkName = "Cola"; Drink[0].drinkCost = 1.00; Drink[0].no_Of_Drinks_In_Machine = 20; Drink[1].drinkName = "Root](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3d8ac351b6_74766f3d8ab8dfdf.jpg)
![Beer"; Drink[1].drinkCost = 1.00; Drink[1].no_Of_Drinks_In_Machine = 20; Drink[2].drinkName = "Lemon Lime"; Drink[2].drinkCost](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3d8ad04277_74866f3d8ac70854.jpg)
![= 1.00; Drink[2].no_Of_Drinks_In_Machine = 20; Drink[3].drinkName = "Grape Soda"; Drink[3].drinkCost = 1.50;](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3d8add3e93_74966f3d8ad4a218.jpg)
![Drink[3].no_Of_Drinks_In_Machine = 20; Drink[4].drinkName = "Cream Soda"; Drink[4].drinkCost = 1.50; Drink[4].no_Of_Drinks_In_Machine =](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3d8aea0b9f_75066f3d8ae1d21a.jpg)
![20; ColaPriceLabel.Text = Drink[0].drinkCost.ToString("c"); RootBeerPriceLabel.Text = Drink[1].drinkCost.ToString("c"); LemonLimePriceLabel.Text = Drink[2].drinkCost.ToString("c"); GrapeSodaPriceLabel.Text =](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3d8af95aa8_75166f3d8af01c59.jpg)
![Drink[3].drinkCost.ToString("c"); CreamSodaPriceLabel.Text = Drink[4].drinkCost.ToString("c"); ColaTextBox.Text = 20.ToString(); RootBeerTextBox.Text = 20.ToString(); LemonLimeTextBox.Text =](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3d8b0827d0_75166f3d8afeb9c6.jpg)

Drink Vending Machine Select a Drink S0.00 S0.00 Root Beer COLA Drinks Left Drinks Left S0.00 S0.00 Lemon Lime Grape Soda Drinks Left Drinks Left S0.00 Total Sales: ream Drinks Left Soda Exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
