Advertisement
Ligh7_of_H3av3n

03. Spacecrafts - Spacecrafts

Jun 21st, 2024
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. package spaceCrafts;
  2.  
  3. public class Spacecraft {
  4.     private final String name;
  5.     private final String missionType;
  6.     private final String target;
  7.     private final String objective;
  8.     private final int weight;
  9.  
  10.     public Spacecraft(String name, String missionType, String target, String objective, int weight) {
  11.         this.name = name;
  12.         this.missionType = missionType;
  13.         this.target = target;
  14.         this.objective = objective;
  15.         this.weight = weight;
  16.     }
  17.  
  18.     public String getName() {
  19.         return name;
  20.     }
  21.  
  22.     public String getMissionType() {
  23.         return missionType;
  24.     }
  25.  
  26.     public String getTarget() {
  27.         return target;
  28.     }
  29.  
  30.     public String getObjective() {
  31.         return objective;
  32.     }
  33.  
  34.     public int getWeight() {
  35.         return weight;
  36.     }
  37.  
  38.     @Override
  39.     public String toString() {
  40.         return String.format("The mission of %s was to reach %s and to %s", name, target, objective);
  41.     }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement