Pearson eText for Starting out with Visual C# -- Instant Access (Pearson+)
Pearson eText for Starting out with Visual C# -- Instant Access (Pearson+)
5th Edition
ISBN: 9780137502783
Author: Tony Gaddis
Publisher: PEARSON+
Question
100%
Book Icon
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”.

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.

Pearson eText for Starting out with Visual C# -- Instant Access (Pearson+), Chapter 9, Problem 2PP

Set the Form Control properties in Properties window as follows:

ObjectPropertySetting
Form1TextProgram8_11
label1TextSelect a Drink
label2Text$1.00
label3TextDrinks Left:
label4Text$1.00
label5TextDrinks Left:
label6Text$1.50
label7TextDrinks Left:
label8Text$1.00
label9TextDrinks Left:
label10TextTotal Sales
label11Text$1.50
label12TextDrinks Left:
lblResultText$0.00
colaText20
rootbeerText20
grapesodaText20
lemonlimeText20
creamsodaText20
pictureBox1ImageSelect Resource
pictureBox2ImageSelect Resource
pictureBox3ImageSelect Resource
pictureBox4ImageSelect Resource
pictureBox5ImageSelect Resource
panel1Text(Empty)
panel2Text(Empty)
panel3Text(Empty)
panel4Text(Empty)
panel5Text(Empty)
panel6Text(Empty)
btnExitTextExit
  • 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.

Blurred answer
Students have asked these similar questions
PLEG136: Week 5 Portofolio Project Motion to Compel
B A E H Figure 1 K Questions 1. List the shortest paths between all node pairs. Indicate the number of shortest paths that pass through each edge. Explain how this information helps determine edge betweenness. 2. Compute the edge betweenness for each configuration of DFS. 3. Remove the edge(s) with the highest betweenness and redraw the graph. Recompute the edge betweenness centrality for the new graph. Explain how the network structure changes after removing the edge. 4. Iteratively remove edges until at least two communities form. Provide step-by-step calculations for each removal. Explain how edge betweenness changes dynamically during the process. 5. How many communities do you detect in the final step? Compare the detected communities with the original graph structure. Discuss whether the Girvan- Newman algorithm successfully captures meaningful subgroups. 6. If you were to use degree centrality instead of edge betweenness for community detection, how would the results change?
Unit 1 Assignment 1 – Loops and Methods (25 points) Task: You are working for Kean University and given the task of building an Email Registration System. Your objective is to generate a Kean email ID and temporary password for every new user. The system will prompt for user information and generate corresponding credentials. You will develop a complete Java program that consists of the following modules: Instructions: 1. Main Method: ○ The main method should include a loop (of your choice) that asks for input from five users. For each user, you will prompt for their first name and last name and generate the email and password by calling two separate methods. Example о Enter your first name: Joe Enter your last name: Rowling 2.generateEmail() Method: This method will take the user's first and last name as parameters and return the corresponding Kean University email address. The format of the email is: • First letter of the first name (lowercase) + Full last name (lowercase) +…

Chapter 9 Solutions

Pearson eText for Starting out with Visual C# -- Instant Access (Pearson+)

Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education