Advertisement
Vladkoheca

WeatherStation.java

Jan 31st, 2025
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | Source Code | 0 0
  1. public class WeatherStation {
  2.     private String stationName;
  3.     private String location;
  4.     private int temperature;
  5.  
  6.     public WeatherStation(String stationName, String location, int temperature) {
  7.         this.stationName = stationName;
  8.         this.location = location;
  9.         this.temperature = temperature;
  10.     }
  11.  
  12.     public String toString() {
  13.         return "The object`s name is " + stationName + "\nThe object`s location is " + location + "\nThe object`s temperature is " + temperature;
  14.     }
  15.  
  16.     public String getStationName() {
  17.         return stationName;
  18.     }
  19.  
  20.     public String getLocation() {
  21.         return location;
  22.     }
  23.  
  24.     public int getTemperature() {
  25.         return temperature;
  26.     }
  27.  
  28.     public void setStationName(String stationName) {
  29.         this.stationName = stationName;
  30.     }
  31.  
  32.     public void setLocation(String location) {
  33.         this.location = location;
  34.     }
  35.  
  36.     public void setTemperature(int temperature) {
  37.         this.temperature = temperature;
  38.     }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement