Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Item B - Folio Exercise 6 - file 2
- package exercise6;
- public class Store {
- private String owner = "Unknown"; //sets intial value of owner as unknown
- public Store(){ //Constuctor
- setOwner(); //makes the class set the owner
- }
- public String getOwner(){
- return owner; //returns the value owner
- }
- public String displayHoursOpen(){
- return "Opening Hours: 9 a.m - 5p.m"; //returns the hours open
- }
- private void setOwner(){
- owner = "Ben Keller"; //sets the owner to whoever (me!)
- }
- // Create the owner instance variable initialized as "not known"
- // Create a public method 'setOwner', accepting a String value as an argument.
- // Create a method getOwner to return the value of the 'owner' variable
- // Create a public method, 'displayHoursOpen', to display
- // the daily hours of operation to the standard output device (the command
- // window).
- // Sample Output:
- // Opening Hours: 9.00am to 3.00pm
- }//end class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement