I need help formatting a printf() statement. If I wanted to print out the following division to three decimal places....
int a=40500;
int b=2900;
System.out.printf( ?, a/b);
What would...
Type: Posts; User: richardman54
I need help formatting a printf() statement. If I wanted to print out the following division to three decimal places....
int a=40500;
int b=2900;
System.out.printf( ?, a/b);
What would...
so something like this...
public int minValue(){// Finds the minimum value value in the array scoreboard
int smallest=scoreboard[0];
for(int j=0;j<13;j++){
if(scoreboard[j] <...
So I trying to find the minimum value in the scoreboard array. I tried this
public int minValue(){// Finds the minimum value value in the array scoreboard
int x=0;
for(int...
Driver:
import javax.swing.JOptionPane;
public class DiceExperiment{
public static void main(String[] args){
String casino=
JOptionPane.showInputDialog("enter a min value");
...
Yes that makes sense. I thought the following would fix it, but it just results in another error.
public void multiToss(){
int score;
while(minValue(int value)==true)// Change
...
I thought I did this in the driver:
import javax.swing.JOptionPane;
public class DiceExperiment{
public static void main(String[] args){
String casino=
...
Ok. I'm having a compilation error in one of the methods
public void multiToss(){
int score;
while(minValue()==true)
score=throwDice();
scoreboard[score]++;
}
I altered the methods a bit more. I've got a compliation error at the moment....but would something like this be effective?
public void multiToss(){
int score;
...
ok thank
oh yeah i see what you mean. Whats the best way of fixing this problem?
i thought i wouldn't need it since I added the minValue() method which contains a for loop testing to see if all of the scoreboard values are less than the entered int
that if statement in...
so i made some changes but it still produces the same output as before:
Heres the Driver
import javax.swing.JOptionPane;
public class DiceExperiment{
public static void main(String[]...
So to do this Im gonna use this method minValue which takes the parameter of the int value from the display window. Whats wrong with this?
public void minValue(int value){
int score=0;
...
where would you recommend i add that?
thats correct
Sorry the Println's are just supposed to be :
System.out.println( j + " " + scoreboard[j]);
In the second column I want to report the number of times each value was rolled, up until each...
Here is the output now:
on the input 10...
2 0
3 2
4 0
5 1
6 1
Here is the driver:
import javax.swing.JOptionPane;
public class DiceExperiment{
public static void main(String[] args){
String casino=
JOptionPane.showInputDialog("enter a toss...
So I'm trying to slightly alter the following Dice Class and Driver
import javax.swing.JOptionPane;
public class DiceExperiment{
public static void main(String[] args){
String casino=...