Project #65327 - java

I need two programs done: 

1st
  1. 1)  Write a program which will simulate rolling 4 dice over and over until all 4 dice show the same value. The program should then report the value rolled and the number of rolls required. You should use the Die class developed in class to implement the simulation.

  2. 2)  Write a class named Holiday that will model the various holidays throughout the year. Your class definition should include fields as you see fit and include a constructor, setters and getters for each field and a toString method. Also, write a small driver program to show your class in action. 

     
     
    Die class for first program
    public class Die
    {
      private int face;
      
      public Die()
      {
        face = 3;
      }
      
      public Die(int value)
      {
        face = value;
      }
      
      public int roll()
      {
        face = (int) ( 1 + 6*Math.random());
        return face;
      }
      
      public int getFaceValue()
      {
        return face;
      }
      
      public void setFaceValue(int value)
      {
        if(1<=value && value <= 6)
          face = value;
      }
      
      public String toString()
      {
        String output = "The face is currently: "+face;
        return output;
      }
      
    }

Subject Computer
Due By (Pacific Time) 04/06/2015 08:59 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy