Results 1 to 7 of 7
  1. #1
    luciawashaya is offline Member
    Join Date
    Oct 2011
    Posts
    11
    Rep Power
    0

    Default help with getter and setter methods of this question.

    Design a Java class PressureController with appropriate data variables, constructors, setter and getter methods from the following information about an industrial boiler pressure controller.

    Description of An Industrial Boiler Pressure Controller

    The controller gets two inputs: sampled values of temperature and pressure coming from the boiler. The controller checks these values against some set maximum and minimum threshold values. If the read signal values are outside the threshold values the controller prints warning messages on computer display for operators .


    [14 marks]

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,439
    Blog Entries
    7
    Rep Power
    20

    Default Re: help with getter and setter methods of this question.

    What are you waiting for? It's your assignment and it's worh 14 marks.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    luciawashaya is offline Member
    Join Date
    Oct 2011
    Posts
    11
    Rep Power
    0

    Default Re: this is my proposed answer

    Java Code:
    class PressureController{
    
    public double maxtmperature;
    
    public double minmperature;
    public double maxPressure;
    public double minmperature;
    PressureCotroller(double a,double b,double c,double d){
    
     maxPressure= a;
    minPressure = b;
    minTemperature = c;
    maxTemperature = d;
    }
    public void setTemp(double Temperature){
    
          this.Temperature= Temperature;
                                      }
    public void getTemperature(){
    return Temperature;}
    
    public void setPressure(double Pressure){
    
      this.Pressure=Pressure;}
    public double checkPressure(){
    if(pressure>minPressure&&pressure<maxPressure){
    System.out.println("Pressure is ok");
    else{System.out.println("Pressure not ok");
                                                                       }
    else if(Temperature>maxTemperature &&Temperature>minTemperature){
    
    System.out.println("Temperature is out of bounce");
    
          else  {System.out.println("Temperature is ok");
    }}}
    Last edited by JosAH; 11-01-2011 at 10:01 AM. Reason: added [code] ... [/code] tags

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,439
    Blog Entries
    7
    Rep Power
    20

    Default Re: help with getter and setter methods of this question.

    That is sloppy code and the compiler will tell you what's wrong with it; b.t.w. the indentation isn't consistent either.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    luciawashaya is offline Member
    Join Date
    Oct 2011
    Posts
    11
    Rep Power
    0

    Default Re: help with getter and setter methods of this question.

    ERROR SAYING ILLEGAL START OF EXPRESSIONON 55

    Java Code:
    class PressureController{
    
    	public double maxTemperature;
    
    	public double minTemperature;
    
    	public double minPressure;
    
    	public double maxPressure;
    
    	double e,f,Temperature,Pressure;
    
    	                    PressureController(double a ,double b,double c,double d){
    
    	                                          maxPressure = a;
    
    	                                         minPressure = b;
    
    	                                     minTemperature = c;
    
    	                                maxPressure = d;
    
    	                                                                }
    	                     public void setTemp(double Temperature){
    
    		                                       e = Temperature;
    						              }
    	                                        public double getTemperature(){
    
    		                                    return Temperature;
    				                                             }
    
    	public void setPressure(double Pressure){
    
    			f = Pressure;
    
    						}
    
    	                                  public double getPressure(){
    
    			                           return Pressure;
                               
    				                                      }
    
    	                        public double CheckTemperature(double Temp){
    
    		    if(Temperature>minTemprature&&Temprature<maxTemperature){
    
    	                                                    System.out.println("Temperature is OK");
    
    									}
    
    
    		                                                    else if {
    			                                            System.out.println("Temperature Out Of Bounds");
    
    									}
    
    		                               public double CheckPressure(double Press){
    
    		                                         if(Pressure>minPressure &&Pressure < maxPressure){
    
    			                                                                  System.out.println("Pressure is ok");
    
    									                            }
    
    		                                                                                    else{
    
    				                       System.out.println("Pressure out of bounds");}
    
    						                                                 }
    			}
    }
    Last edited by JosAH; 11-01-2011 at 10:58 AM. Reason: added [code] ... [/code] tags again.

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,439
    Blog Entries
    7
    Rep Power
    20

    Default Re: help with getter and setter methods of this question.

    Count your curly brackets and see if they match (b.t.w. your indentation is a mess, fix it).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    luciawashaya is offline Member
    Join Date
    Oct 2011
    Posts
    11
    Rep Power
    0

    Default Re: help with getter and setter methods of this question.

    it has compiled thyanx

Similar Threads

  1. Question concerning methods
    By jim01 in forum New To Java
    Replies: 6
    Last Post: 05-18-2011, 02:46 PM
  2. 2 methods with same name Question
    By dienesh77 in forum New To Java
    Replies: 4
    Last Post: 03-22-2011, 01:58 PM
  3. getter and setter method help please!
    By merdzins in forum New To Java
    Replies: 2
    Last Post: 12-06-2010, 05:06 AM
  4. use of private in getter and setter
    By katturv in forum New To Java
    Replies: 1
    Last Post: 12-03-2010, 07:17 PM
  5. Replies: 4
    Last Post: 01-01-2009, 12:03 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
  •