Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 2.03 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /**====================================================
  2.   Christopher Carlsen
  3.   05/15/2012
  4.   Lab   5:B - MonthlyEggCount Class
  5. ====================================================**/
  6.  
  7.  
  8. import java.util.Random; //Imports the Random class
  9.  
  10. /** Class: MonthlyEggCount.java        
  11.  
  12.  ** Purpose: This class, when called on, will generate a
  13.  ** MonthlyEggCount object, which will then randomly produce
  14.  ** three integer values for the three seperate "chicken"
  15.  ** attributes. It will then store those values and allow the
  16.  ** calling program to "get" them.                                                              */
  17.  
  18. public class MonthlyEggCount
  19. {
  20.         private int chicken1;
  21.         private int chicken2;
  22.         private int chicken3;
  23.        
  24.         Random eggCount = new Random(); //Creates a new Random object
  25.        
  26.        
  27.         /** Method: MonthlyEggCount constructor
  28.          **
  29.          ** Purpose: When called, will generate
  30.          ** three random integer values and store
  31.          ** them for use by the other methods.                                                  */
  32.         public MonthlyEggCount()
  33.         {
  34.         chicken1 = eggCount.nextInt(26);
  35.         chicken2 = eggCount.nextInt(26);
  36.         chicken3 = eggCount.nextInt(26);
  37.         }
  38.        
  39.        
  40.         /** Method: getMonthTotal
  41.          **
  42.          ** Purpose: When called, will return the sum of
  43.          ** chicken1 through chicken3.                                                                  */
  44.         public int getMonthTotal()
  45.         {
  46.         return chicken1 + chicken2 + chicken3;
  47.         }
  48.        
  49.        
  50.         /** Method: getChicken1
  51.          **
  52.          ** Purpose: When called, will return the integer value
  53.          ** stored for chicken1.                                                                                        */
  54.         public int getChicken1()
  55.         {
  56.         return chicken1;
  57.         }
  58.        
  59.        
  60.         /** Method: getChicken1
  61.          **
  62.          ** Purpose: When called, will return the integer value
  63.          ** stored for chicken2.                                                                                        */      
  64.         public int getChicken2()
  65.         {
  66.         return chicken2;
  67.         }
  68.        
  69.        
  70.         /** Method: getChicken1
  71.          **
  72.          ** Purpose: When called, will return the integer value
  73.          ** stored for chicken3.                                                                                        */
  74.         public int getChicken3()
  75.         {
  76.         return chicken3;
  77.         }
  78.        
  79.        
  80.         /** Method: getGraph
  81.          **
  82.          ** Purpose: When called, will return a bar graph made
  83.          ** from asterisk symbols.                              */     
  84.         public int getGraph()
  85.         {
  86.         //??????????????????????
  87.         }
  88. }