Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i am trying to develop java class for the following UML class also the method sh

ID: 3812440 • Letter: I

Question

i am trying to develop java class for the following UML class also the method should have timing for the lights automatically

  Out Door Lights

dayTimeSaving: int

standardTimeSaving: int

on: boolean

__________________________________________________________________

+OutDoorLights()

+timeOn() : void

+timeOff() : void

+setDayTimeSaving(newDayTimeSaving: int) : void

+setStandardTimeSaving(newStandardTimeSaving: int) : void

+dayTimeSavingOn(): void

+dayTimeSavingOff(): void

+standardTimeSavingOn(): void

+standardTimeSavingOff(): void

this is what i did

public class OutDoorLights {

   public static void main(String[] args) {

       // Declare int

       int dayTimeSaving = 2030; // military time = 8:30pm

       int standardTimeSaving = 1730; // military time = 5:30pm

       int hour = 24;

       boolean on = false; // OutDoorLights off

       int x = (int)(Math.random() * 24); // code to create time

   }

      public int newStandardTimeSaving;

       public OutDoorLights(){ // OutDoorLights constructor object of the class

       }

       public void turnOn() { // turn on OutDoorLights

           boolean on = true;

       }

       public void turnOff(){ //turn off OutDoorLights

           boolean on = false;

       }

       public void setDaytimeSaving(int dayTimeSaving) { // set daytime saving

           boolean on = false;

           int newDayTimeSaving = 0;

           if ( on && dayTimeSaving >=2030 && dayTimeSaving <= 24)

               // create object of the dayTimeSaving class

               dayTimeSaving = newDayTimeSaving;

       }

       public void setStandardtimeSaving(int standardTimeSaving) { // set daytime saving

          

           boolean on = false;

           int x = (int)(Math.random() * 24); // code to create time

           if ( on && standardTimeSaving >=1730 && standardTimeSaving <= 24)

               // create object of the standardTimeSaving

               standardTimeSaving = newStandardTimeSaving;

Explanation / Answer

Based on the UML, this is how your class should look like. You must have class member variables, member functions and then within main function an object must be created for the class. But since you havent provided the complete requirement< i'm not able to fill the entire methods. However this is how your class structure will look.

package util;

public class OutDoorLights {

  

   private int dayTimeSaving;

   private int standardTimeSaving;

   private boolean on;

  

   public OutDoorLights() {

       dayTimeSaving = 0;

       standardTimeSaving = 0;

       on = false;

   }

  

   public void timeOn()

   {

       on = true;

   }

  

   public void timeOff()

   {

       on = false;

   }

  

   public void setDayTimeSaving(int newDayTimeSaving)

   {

       dayTimeSaving = newDayTimeSaving;

   }

  

   public void setStandardTimeSaving(int newStandardTimeSaving)

   {

       standardTimeSaving = newStandardTimeSaving;

   }

  

   public void dayTimeSavingOn()

   {

       //Need requirement

   }

  

   public void dayTimeSavingOff()

   {

       //Need requirement

   }

  

   public void standardTimeSavingOn()

   {

       //Need requirement

   }

  

   public void standardTimeSavingOff()

   {

       //Need requirement

   }

   public static void main(String[] args) {

       OutDoorLights lights = new OutDoorLights();

       lights.setDayTimeSaving(2030);

   }

}