Advertisement
Guest User

Store Class

a guest
May 24th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. //Item B - Folio Exercise 6 - file 2
  2.  
  3. package exercise6;
  4.  
  5. public class Store {
  6.     private String owner = "Unknown"; //sets intial value of owner as unknown
  7.    
  8.     public Store(){ //Constuctor
  9.         setOwner(); //makes the class set the owner
  10.     }
  11.     public String getOwner(){
  12.         return owner; //returns the value owner
  13.     }
  14.     public String displayHoursOpen(){
  15.         return "Opening Hours: 9 a.m - 5p.m"; //returns the hours open
  16.     }
  17.     private void setOwner(){
  18.         owner = "Ben Keller"; //sets the owner to whoever (me!)
  19.     }
  20.        
  21.   // Create the owner instance variable initialized as "not known"    
  22.    
  23.   // Create a public method 'setOwner', accepting a String value as an argument.
  24.    
  25.   // Create a method getOwner to return the value of the 'owner' variable
  26.    
  27.   // Create a public method, 'displayHoursOpen', to display
  28.   //     the daily hours of operation to the standard output device (the command
  29.   //     window).
  30.   //        Sample Output:
  31.   //        Opening Hours:   9.00am to 3.00pm
  32.    
  33.  
  34. }//end class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement