EBK STARTING OUT WITH VISUAL C#
5th Edition
ISBN: 9780135204818
Author: GADDIS
Publisher: VST
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
Chapter 9, Problem 2PP
Program Plan Intro
Drink vending machine simulator
Program plan:
Design the form:
- Place an eighteen label box controls on the form, and change its name and properties.
- Place a five picture box control on the form, and change its name and properties to display the images.
- Place a six panel controls on the form, and change its name and properties.
- Place a one command button control on the form, and change its name and properties to exit the application.
In code window, write the code:
Program.cs:
- Include the required libraries.
- Define the namespace “VendingMachine”.
- Define a class “Program”.
- Define a constructor for the class.
- Define required functions to run “Form1”.
- Define a class “Program”.
Form1.cs:
- Include the required libraries.
- Define namespace “VendingMachine”.
- Define the structure with name “DrinkEntery”.
- Define a class “Form1”.
- In updateData() method,
- Declare the required variables.
- When user selects a drink, the application decrement “1” from the selected drink quantity.
- The cost is added to total sales and it is displayed into label box.
- In pictureBox1_Click() method,
- Set the index value as “0” and call the updateData() method to perform this drink vending machine simulation.
- In pictureBox2_Click() method,
- Set the index value as “1” and call the updateData() method to perform this drink vending machine simulation.
- In pictureBox3_Click() method,
- Set the index value as “3” and call the updateData() method to perform this drink vending machine simulation.
- In pictureBox4_Click() method,
- Set the index value as “2” and call the updateData() method to perform this drink vending machine simulation.
- In pictureBox5_Click() method,
- Set the index value as “4” and call the updateData() method to perform this drink vending machine simulation.
- In btnExit() method,
- Close the application.
Form Design:
View the Form Design in IDE.
Set the Form Control properties in Properties window as follows:
Object | Property | Setting |
Form1 | Text | Program8_11 |
label1 | Text | Select a Drink |
label2 | Text | $1.00 |
label3 | Text | Drinks Left: |
label4 | Text | $1.00 |
label5 | Text | Drinks Left: |
label6 | Text | $1.50 |
label7 | Text | Drinks Left: |
label8 | Text | $1.00 |
label9 | Text | Drinks Left: |
label10 | Text | Total Sales |
label11 | Text | $1.50 |
label12 | Text | Drinks Left: |
lblResult | Text | $0.00 |
cola | Text | 20 |
rootbeer | Text | 20 |
grapesoda | Text | 20 |
lemonlime | Text | 20 |
creamsoda | Text | 20 |
pictureBox1 | Image | Select Resource |
pictureBox2 | Image | Select Resource |
pictureBox3 | Image | Select Resource |
pictureBox4 | Image | Select Resource |
pictureBox5 | Image | Select Resource |
panel1 | Text | (Empty) |
panel2 | Text | (Empty) |
panel3 | Text | (Empty) |
panel4 | Text | (Empty) |
panel5 | Text | (Empty) |
panel6 | Text | (Empty) |
btnExit | Text | Exit |
- Add eighteen label box controls to the form from Toolbox.
- Add five picture box controls to the form from Toolbox.
- Add six panel controls to the form from Toolbox.
- Add one command button control to the form from Toolbox.
Expert Solution & Answer
Trending nowThis is a popular solution!
Chapter 9 Solutions
EBK STARTING OUT WITH VISUAL C#
Ch. 9.2 - Prob. 9.1CPCh. 9.2 - Prob. 9.2CPCh. 9.2 - Prob. 9.3CPCh. 9.2 - Prob. 9.4CPCh. 9.2 - Prob. 9.5CPCh. 9.2 - Prob. 9.6CPCh. 9.2 - Prob. 9.7CPCh. 9.2 - Prob. 9.8CPCh. 9.3 - Prob. 9.9CPCh. 9.3 - Prob. 9.10CP
Ch. 9.3 - Prob. 9.11CPCh. 9.3 - Prob. 9.12CPCh. 9.3 - Prob. 9.13CPCh. 9.3 - Prob. 9.14CPCh. 9.3 - Prob. 9.15CPCh. 9.3 - Prob. 9.16CPCh. 9.4 - Prob. 9.17CPCh. 9.4 - Prob. 9.18CPCh. 9.4 - Prob. 9.19CPCh. 9.5 - Prob. 9.20CPCh. 9.5 - Prob. 9.21CPCh. 9.5 - Prob. 9.22CPCh. 9.5 - Prob. 9.23CPCh. 9.5 - Prob. 9.24CPCh. 9 - Prob. 1MCCh. 9 - Prob. 2MCCh. 9 - Prob. 3MCCh. 9 - Prob. 4MCCh. 9 - Prob. 5MCCh. 9 - Prob. 6MCCh. 9 - Prob. 7MCCh. 9 - Prob. 8MCCh. 9 - Prob. 9MCCh. 9 - Prob. 10MCCh. 9 - Prob. 11MCCh. 9 - Prob. 12MCCh. 9 - Prob. 13MCCh. 9 - Prob. 14MCCh. 9 - Prob. 1TFCh. 9 - Prob. 2TFCh. 9 - Prob. 3TFCh. 9 - Prob. 4TFCh. 9 - Prob. 5TFCh. 9 - Prob. 6TFCh. 9 - Prob. 7TFCh. 9 - Prob. 8TFCh. 9 - Prob. 9TFCh. 9 - Prob. 10TFCh. 9 - Prob. 11TFCh. 9 - Prob. 12TFCh. 9 - Prob. 13TFCh. 9 - Prob. 1SACh. 9 - Prob. 2SACh. 9 - Prob. 3SACh. 9 - Prob. 4SACh. 9 - Prob. 5SACh. 9 - Prob. 6SACh. 9 - Prob. 7SACh. 9 - Prob. 1AWCh. 9 - Prob. 2AWCh. 9 - Prob. 3AWCh. 9 - Prob. 4AWCh. 9 - Prob. 5AWCh. 9 - Prob. 6AWCh. 9 - Prob. 7AWCh. 9 - Prob. 8AWCh. 9 - Prob. 9AWCh. 9 - WEATHER DATA In the student sample progr4n files...Ch. 9 - Prob. 2PPCh. 9 - Prob. 3PPCh. 9 - Prob. 4PPCh. 9 - Prob. 5PPCh. 9 - COURSE INFORMATION Write a program that creates a...Ch. 9 - Prob. 7PPCh. 9 - Prob. 8PPCh. 9 - Prob. 9PPCh. 9 - Prob. 10PPCh. 9 - Prob. 11PPCh. 9 - Prob. 12PP
Knowledge Booster
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education