I need to design a class to represent an oven control unit containing:
- Three constants (COOK, BOIL, SELF_CLEANING) with values of 1, 2, & 3.
- Boolean value 'on' to represent oven is on or off
- Int value for cooking temp, actual temp, and cook time (in min)
- No-arg constructor that creates the oven
- Accessor & mutator methods for all the data fields
- a method for reportStatus to repost the state of oven and oven control for all data fields

So far I have:

public class Oven 
{

   final static double COOK = 1;
   final static double BROIL = 2;
   final static double SELF_CLEANING = 3;

   boolean on;

   int setTemp;
   int actualTemp;
   int setTime;
   int ovenMode;
   
   Oven() 
     {
     }

   reportStatus()
      {
      }
}

Still getting used to Java, anyone help me out here?

Im not totally sure about what you want but I think that I understood the just of it. I think this will help you out, if not then be a-little more clear and I'll try to help

public class Oven 
{
 
   final static double COOK = 1;
   final static double BROIL = 2;
   final static double SELF_CLEANING = 3;
 
   boolean on;
 
   int setTemp;
   int actualTemp;
   int setTime;
   int ovenMode;
 
   public Oven() 	// No argument constructor
     {
     }
   
   void setPower(boolean power)
   {
	   on = power;
   }
   
   void setTemp(int ovenTemp)
   {
	   setTemp = ovenTemp;
   }
   
   void setActTemp(int actTemp)
   {
	   actualTemp = actTemp;
   }
   
   void setTime(int time)
   {
	   setTime = time;
   }
 
   void reportStatus()
   {
	   System.out.println("Power Status: "+on+"\nSet Temperature "+setTemp+"\nActual Temperature: "+actualTemp+"\nTime: "+setTime);
   }
   
}

And Im sure you already know how to use this but if not this should help:

public class useOven {

	public static void main(String [] args)
	{
		Oven myOven = new Oven();
		
		myOven.setPower(true);
		myOven.setTemp(30);
		myOven.setActTemp(40);
		myOven.setTime(45);
		
		myOven.reportStatus();
		
	}
	
}
This article has been dead for over six months. Start a new discussion instead.