CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #3
    Join Date
    Sep 2011
    Posts
    197

    Re: turn on the airconditioner

    Code:
       public static void officeAC() {
     
       AirConditioner officeAC = new AirConditioner();
        officeAC.turnOn();
       officeAC.setTemp(69);
     }
    I used a method, because you didn't specify wheather you wanted it in a class or what. You could do it in many way's use super class AirConditoinar with subclass's that extend it, like officeAC, and gymAC etc.. But, this would go right inside the same class.

    Code:
      public AirConditioner(boolean On, int Temp) {
      }
    
        public static void officeAC() {
       AirConditioner  officeAC = new AirConditioner(true, 69);
     // other expressions you want for officeAC
    }
    You could do that if you the AirConditioner construct was set with arguments for it's temp, and being on or off.
    Last edited by kolt007; October 6th, 2011 at 03:08 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured