1 6 1) Trace the game. 2) Just give the answer. Please enter 1 or 2 Please enter the dice face number that you would like to be repeated. Please enter the number of times that you would like 6 to appear in a row. 3 You got a 1 Number of times in a row so far is 0 Number of throws is 1 You got a 6 Number of times in a row so far is 1 Number of throws is 2 You got a 2 Number of times in a row so far is 0 Number of throws is 3
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
I need help fixing a java program that includes an if and else statement where it shows the process and the other just prints the number of throws it took:
Version 1 section
Java code:
import java.util.Scanner;
public class Part_2 {
public static void main(String[] args) {
int diceFaceNumber, numTimes, numThrows;
System.out.print(" This game throws a dice until a particular dice face number");
System.out.print(" appears in a row a certain number of times.");
System.out.print("Please enter the version you want:");
System.out.print(" 1) Trace the game.");
System.out.print(" 2) Just give the answer");
System.out.print("Please enter 1 or 2");
if (input == 1);
Scanner input = new Scanner(System.in);
System.out.print("Please enter the die face number you would like to be repeated. ");
diceFaceNumber = input.nextInt();
System.out.print("How many times you want that die face number to appear in a row? : ");
numTimes = input.nextInt();
numThrows = computeNumThrows(diceFaceNumber, numTimes);
printOutput(diceFaceNumber, numTimes, numThrows);
}
private static int computeNumThrows(int diceFaceNumber, int numTimes) {
int numThrows = 0;
int count = 0;
while (count < numTimes) {
int die = (int)(Math.random() * 6) + 1;
numThrows++;
if (die == diceFaceNumber)
count++;
else
count = 0;
}
return numThrows;
}
private static void printOutput(int diceFaceNumber, int numTimes, int numThrows) {
System.out.println("It took " + numThrows + " throws to get " + numTimes + " " + diceFaceNumber + "'s in a row.");
System.out.println(" Would you like to play the game again? ");
System.out.println(" Please enter (yes/no)");
}
}
![1
6
1) Trace the game.
2) Just give the answer.
Please enter 1 or 2
Please enter the dice face number that you would like to be repeated.
Please enter the number of times that you would like 6 to appear in a row.
3
You got a 1
Number of times in a row so far is 0
Number of throws is 1
You got a 6
Number of times in a row so far is 1
Number of throws is 2
You got a 2
Number of times in a row so far is 0
Number of throws is 3](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fea56b2d3-976b-48ba-b1de-ef5a4d536379%2F6175dcfa-c762-4436-a9b8-1a86cc800046%2Fbs83vk_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)