Starting Out With Visual C# (5th Edition)
Starting Out With Visual C# (5th Edition)
5th Edition
ISBN: 9780135183519
Author: Tony Gaddis
Publisher: PEARSON
Question
Book Icon
Chapter 5, Problem 9PP
Program Plan Intro

Dice simulator

Program plan:

Design the form:

  • Place a two picture box controls on the form, and change its name and properties to display the dices.
  • Place a one command button control on the form, and change its name and properties to simulates the rolling a pair of dices.

In code window, write the code:

Program.cs:

  • Include the required libraries.
  • Define the namespace “Dice”.
    • Define a class “Program”.
      • Define a constructor for the class.
      • Define required functions to run “Form1”.

Form1.cs:

  • Include the required libraries.
  • Define namespace “Dice”.
    • Define a class “Form1”.
    • In Form1_Load() method,
      • Create an object for Random class to generate two random numbers in the range of “1” through “6” for Dice1 and Dice2.
      • Use switch case to display the respective dice image in picture Box1.
      • Use switch case to display the respective dice image in picture Box2.
    • Close the application.

Form Design:

View the Form Design in IDE.

Starting Out With Visual C# (5th Edition), Chapter 5, Problem 9PP

Set the Form Control properties in Properties window as follows:

ObjectPropertySetting
Form1TextProgram5_9
pictureBox1InitialImageSelect Resource
pictureBox1InitialImageSelect Resource
btnDiceTextRoll Dices
  • Add two picture box controls to the form from Toolbox.
  • Add one command button control to the form from Toolbox.

Blurred answer
Students have asked these similar questions
Theater RevenueA movie theater only keeps a percentage of the revenue earned from ticket sales. The remainder goes to the movie company. Create a GUI application that allows the user to enter the following data into text fields:� Price per adult ticket� Number of adult tickets sold� Price per child ticket� Number of child tickets soldThe application should calculate and display the following data for one night�s box office business at a theater:� Gross revenue for adult tickets sold. This is the amount of money taken in for all adult tickets sold.� Net revenue for adult tickets sold. This is the amount of money from adult ticket sales left over after the payment to the movie company has been deducted.� Gross revenue for child tickets sold. This is the amount of money taken in for all child tickets sold.� Net revenue for child tickets sold. This is the amount of money from child ticket sales left over after the payment to the movie company has been deducted.� Total gross revenue. This…
Theater RevenueA movie theater only keeps a percentage of the revenue earned from ticket sales. The remainder goes to the movie company. Create a GUI application that allows the user to enterthe following data into text fields:• Price per adult ticket• Number of adult tickets sold• Price per child ticket• Number of child tickets soldThe application should calculate and display the following data for one night’s box officebusiness at a theater:• Gross revenue for adult tickets sold. This is the amount of money taken in for all adulttickets sold.• Net revenue for adult tickets sold. This is the amount of money from adult ticket salesleft over after the payment to the movie company has been deducted.• Gross revenue for child tickets sold. This is the amount of money taken in for all childtickets sold.• Net revenue for child tickets sold. This is the amount of money from child ticket salesleft over after the payment to the movie company has been deducted.• Total gross revenue. This is the…
No plagarism please! Code with comments and output screenshot is must for an Upvote. Thank you!

Chapter 5 Solutions

Starting Out With Visual C# (5th Edition)

Ch. 5.4 - Name the three expressions that appear inside the...Ch. 5.4 - You want to write a for loop that displays I love...Ch. 5.4 - What would the following code display? for (int...Ch. 5.4 - What would the following code display? for (int...Ch. 5.5 - What is a posttest loop?Ch. 5.5 - What is the difference between the while loop and...Ch. 5.5 - How many times will the following loop iterate?...Ch. 5.6 - What is an output file?Ch. 5.6 - What is an input file?Ch. 5.6 - What three steps must be taken by a program when...Ch. 5.6 - What is the difference between a text file and a...Ch. 5.6 - Prob. 5.22CPCh. 5.6 - What type of object do you create if you want to...Ch. 5.6 - What type of object do you create if you want to...Ch. 5.6 - If you call the File.CreateText method and the...Ch. 5.6 - If you call the File.AppendText method and the...Ch. 5.6 - What is the difference between the WriteLine and...Ch. 5.6 - What method do you call to open a text file to...Ch. 5.6 - What is a files read position? Initially, where is...Ch. 5.6 - How do you read a line of text from a text file?Ch. 5.6 - How do you close a file?Ch. 5.6 - Assume inputFile references a StreamReader object...Ch. 5.7 - What is the benefit of using an Open and/or Save...Ch. 5.7 - Prob. 5.34CPCh. 5.8 - What does a Random objects Next method return?Ch. 5.8 - What does a Random objects NextDouble method...Ch. 5.8 - Write code that creates a Random object and then...Ch. 5.8 - Write code that creates a Random object and then...Ch. 5.8 - Prob. 5.39CPCh. 5.8 - What happens if the same seed value is used each...Ch. 5.9 - Prob. 5.41CPCh. 5.9 - Prob. 5.42CPCh. 5 - ListBox controls have an __________ method that...Ch. 5 - A __________ is commonly used to control the...Ch. 5 - A(n) __________ loop tests its condition before...Ch. 5 - The term __________ is used to describe a file...Ch. 5 - The term __________ file is used to describe a...Ch. 5 - A __________ file contains data that has been...Ch. 5 - When you work with a __________ file you access...Ch. 5 - Prob. 8MCCh. 5 - A __________ object is an object that is...Ch. 5 - When a program works with an input file, a special...Ch. 5 - When the user selects a file with the Open dialog...Ch. 5 - The __________ control displays a standard Windows...Ch. 5 - Once you have created a Random object, you can...Ch. 5 - Prob. 14MCCh. 5 - When you run an application, the applications form...Ch. 5 - If the ListBox is empty, the Items.Count property...Ch. 5 - To increment a variable means to increase its...Ch. 5 - When a variable is declared in the initialization...Ch. 5 - The while loop always performs at least one...Ch. 5 - The term read file is used to describe a file that...Ch. 5 - To append data to an existing file, you open it...Ch. 5 - As items are read from the file, the read position...Ch. 5 - The numbers that are generated by the Random class...Ch. 5 - Prob. 10TFCh. 5 - What is contained in the body of a loop?Ch. 5 - Write a programming statement that uses postfix...Ch. 5 - How many iterations will occur if the test...Ch. 5 - What are filename extensions? What do they...Ch. 5 - When an input file is opened, what is its read...Ch. 5 - How can you read all of the items in a file...Ch. 5 - What is a variable that is used to accumulate a...Ch. 5 - By default, the Open dialog box displays the...Ch. 5 - Prob. 9SACh. 5 - Prob. 10SACh. 5 - Write a loop that displays your name 10 times.Ch. 5 - Write a loop that displays all the odd numbers...Ch. 5 - Write a loop that displays every fifth number from...Ch. 5 - Write a code sample that uses a loop to write the...Ch. 5 - Assume that a file named People.txt contains a...Ch. 5 - Distance Calculator If you know a vehicles speed...Ch. 5 - Distance File Modify the Distance Calculator...Ch. 5 - Celsius to Fahrenheit Table Assuming that C is a...Ch. 5 - Prob. 4PPCh. 5 - Pennies for Pay Susan is hired for a job, and her...Ch. 5 - Prob. 6PPCh. 5 - Prob. 7PPCh. 5 - Prob. 8PPCh. 5 - Prob. 9PPCh. 5 - Addition Tutor Create an application that...Ch. 5 - Random Number Guessing Game Create an application...Ch. 5 - Calculating the Factorial of a Number In...Ch. 5 - Random Number File Writer Create an application...Ch. 5 - Random Number File Reader This exercise assumes...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
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