Advertisement
Vladkoheca

Meteorologist.java

Jan 31st, 2025 (edited)
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | Source Code | 0 0
  1. public class Meteorologist {
  2.     private String name;
  3.     private int yearsOfExp;
  4.     private String speciality;
  5.  
  6.     public Meteorologist(String name, int yearsOfExp, String speciality) {
  7.         this.name = name;
  8.         this.yearsOfExp = yearsOfExp;
  9.         this.speciality = speciality;
  10.     }
  11.  
  12.     public void displayInfo() {
  13.         System.out.println("The name of the meteorologist is: " + name + "\nThe years of experience of the meteorologist are: " + yearsOfExp + "\nThe speciality of the meteorologist is: " + speciality);
  14.     }
  15.  
  16.     public String getName() {
  17.         return name;
  18.     }
  19.  
  20.     public int getYearsOfExp() {
  21.         return yearsOfExp;
  22.     }
  23.  
  24.     public String getSpeciality() {
  25.         return speciality;
  26.     }
  27.  
  28.     public void setName(String name) {
  29.         this.name = name;
  30.     }
  31.  
  32.     public void setYearsOfExp(int yearsOfExp) {
  33.         this.yearsOfExp = yearsOfExp;
  34.     }
  35.  
  36.     public void setSpeciality(String speciality) {
  37.         this.speciality = speciality;
  38.     }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement