Question

Design an application that uses the C# random generator to randomly roll a six face dice ( no 1 - no 6) . If the user rolled a 3, the user gets to roll the six face die again. You must use a switch statement to write the result /s of the random dice roll/s to the screen. Hint: You should have nested switches in your program

Answer #1

class HelloWorld {

static void Main() {

Random rand = new Random();

while(true)

{

int a = rand.Next(1, 7); // generating the Random number between 1
and 6

switch(a)

{

case 1: Console.WriteLine("The user has rolled one (" + a + ")");
break;

case 2: Console.WriteLine("The user has rolled two (" + a + ")");
break;

case 3: Console.WriteLine("The user has rolled three (" + a + ")");
break;

case 4: Console.WriteLine("The user has rolled four (" + a + ")");
break;

case 5: Console.WriteLine("The user has rolled five (" + a + ")");
break;

case 6: Console.WriteLine("The user has rolled six (" + a + ")");
break;

}

if(a != 3) // if it is 3 the user will roll down again

{

break;

}

}

}

}

**OUTPUT :**

Dice Rolling) Write an application to simulate the
rolling of two dice. The application should use an object of class
Random once to roll the first die and again to roll the second die.
The sum of the two values should then be calculated. Each die can
show an integer value from 1 to 6, so the sum of the values will
vary from 2 to 12, with 7 being the most frequent sum and 2 and 12
being the...

Suppose you roll six-sided dice four times and write down the
resulting four digit number. We sat that a number is "balanced" if
it contains an equal number of even and odd terms. What is the
probability that the result of rolling the die is balanced?

In java create a dice game called sequences also known as
straight shooter. Each player in turn rolls SIX dice and scores
points for any sequence of CONSECUTIVE numbers thrown beginning
with 1. In the event of two or more of the same number being rolled
only one counts. However, a throw that contains three 1's cancels
out player's score and they mst start from 0. A total of scores is
kept and the first player to reach 100 points,...

1.The number showing on the upper face of a fair six-sided dice
is observed when rolled. Consider events A and B defined as:
A = the number observed is at most 2
B = the number observed is an even number
Find： 1.P(A') 2.P(A or B)
2.Along the road near Bundamba State High School, there are
traffic lights at two different locations. At the first location,
the light is green 80.9% of the time. At the second location, the
light...

JAVA: MUST BE DONE IN JAVA
Assignment: Write algorithms and programs to
play “non-betting” Craps. Craps is a game played with a pair of
dice. In the game, the shooter (the player with the dice)
rolls a pair of dice and the number of spots showing on the two
upward faces are added up. If the opening roll (called the
“coming out” roll) is a 7 (“natural”) or 11
(“yo-leven”), the shooter immediately wins the game. If
the coming out...

Task #4 Calculating the Mean
Now we need to add lines to allow us to read from the input
file and calculate the mean.
Create a FileReader object passing it the filename.
Create a BufferedReader object passing it the FileReader
object.
Write a priming read to read the first line of the file.
Write a loop that continues until you are at the end of the
file.
The body of the loop will:
convert the line into a double value...

1. A random number generator is used to select a number from 1
to
500 ?(inclusively).
What is the probability of selecting the number 595
?
What is the probability?
2.Identify the sample space of the probability experiment and
determine the number of outcomes in the sample space.
-Randomly choosing an even number between 10 and 20,
inclusive
The sample space is?
(Use a comma to separate answers)
There are _____ outcomes in the sample space
3. Determine the number...

C++
Homework on Loop Structure
A treasure is hidden someplace – the treasures coordinates are
(x1, y1)! The coordinates (x1, y1) are determined randomly, using
the code that is listed at the end of this exercise. The purpose of
the game is for the Explorer to find the Treasure!
The explorer is allowed to go North, South, West or East by
one step each time. The Explorer is first positioned at location
(15,15). If the explorer goes North by one...

Do the following problems. 1. Each of three barrels from a
manufacturing line are classified as either above (a) or below (b)
the target weight. Provide the ordered sample space. 2. The heat on
each of two soldered parts is measured and labeled as either low
(l), medium (m), or high (h). State the number of elements in the
ordered sample space. 3. Consider the set of Beatles songs with a
primary writer as either Paul McCartney (P) or John...

For a C program hangman game:
Create the function int setup_game [int
setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int
numwords)] for a C program hangman game. (The existing code
for other functions and the program is below, along with what the
function needs to do)
What int setup_game needs to do
setup_game() does exactly what the name suggests. It sets up a
new game of hangman. This means that it picks a random word from
the supplied wordlist array and...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 1 minute ago

asked 37 minutes ago

asked 50 minutes ago

asked 59 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 2 hours ago

asked 2 hours ago

asked 2 hours ago