Block of Code

Practical Examples for Programmers

  • Home
  • C++
  • Java
  • Visual Basic
  • Discrete Math
  • Ask a Question

Dice

Using Visual Basic, write a program for a simple game in which each of two players rolls a pair of dice.  The person with the highest tally wins.  See the figure below.  The program should use a class called HighRoller having two member variables of the type PairOfDice discussed in Exercise 21 of Section 11.1.

REMOVE REFERENCE TO EXERCISE BEFORE FINAL DRAFT.

Dice Screenshot
Suggested Control Names and Attributes:

Name Property Text Property Control Type Notes
 frmDice Dice Form Holds Controls
 txtDie1 TextBox  Displays die 1 number *
 txtDie2 TextBox  Displays die 2 number *
 txtDie3 TextBox  Displays die 3 number *
 txtDie4 TextBox  Displays die 4 number *
 btnPlay  Play Button  Triggers event to roll rice
 txtWinner TextBox  Displays the winner *

* Read Only property should be set to True.

Secondary Sidebar

This is the secondary sidebar

Copyright © 2025 · Metro Pro Theme on Genesis Framework · WordPress · Log in