Search:

Type: Posts; User: richardman54

Search: Search took 0.34 seconds.

  1. Replies
    1
    Views
    163

    Help with Printf statement

    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...
  2. Re: Help with method. Finding minimum value in Array

    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] <...
  3. Help with method. Finding minimum value in Array

    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...
  4. Replies
    28
    Views
    409

    Re: Help altering dice program?

    Driver:


    import javax.swing.JOptionPane;
    public class DiceExperiment{
    public static void main(String[] args){
    String casino=
    JOptionPane.showInputDialog("enter a min value");
    ...
  5. Replies
    28
    Views
    409

    Re: Help altering dice program?

    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
    ...
  6. Replies
    28
    Views
    409

    Re: Help altering dice program?

    I thought I did this in the driver:


    import javax.swing.JOptionPane;
    public class DiceExperiment{
    public static void main(String[] args){
    String casino=
    ...
  7. Replies
    28
    Views
    409

    Re: Help altering dice program?

    Ok. I'm having a compilation error in one of the methods



    public void multiToss(){
    int score;
    while(minValue()==true)
    score=throwDice();
    scoreboard[score]++;
    }
  8. Replies
    28
    Views
    409

    Re: Help altering dice program?

    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;
    ...
  9. Replies
    28
    Views
    409

    Re: Help altering dice program?

    ok thank
  10. Replies
    28
    Views
    409

    Re: Help altering dice program?

    oh yeah i see what you mean. Whats the best way of fixing this problem?
  11. Replies
    28
    Views
    409

    Re: Help altering dice program?

    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...
  12. Replies
    28
    Views
    409

    Re: Help altering dice program?

    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[]...
  13. Replies
    28
    Views
    409

    Re: Help altering dice program?

    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;
    ...
  14. Replies
    28
    Views
    409

    Re: Help altering dice program?

    where would you recommend i add that?
  15. Replies
    28
    Views
    409

    Re: Help altering dice program?

    thats correct
  16. Replies
    28
    Views
    409

    Re: Help altering dice program?

    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...
  17. Replies
    28
    Views
    409

    Re: Help altering dice program?

    Here is the output now:

    on the input 10...


    2 0
    3 2
    4 0
    5 1
    6 1
  18. Replies
    28
    Views
    409

    Help altering dice program?

    Here is the driver:


    import javax.swing.JOptionPane;
    public class DiceExperiment{
    public static void main(String[] args){
    String casino=
    JOptionPane.showInputDialog("enter a toss...
  19. Replies
    1
    Views
    178

    Help With Code?

    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=...
Results 1 to 19 of 19