Advertisement
Gologo

ind 3

May 20th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. abstract class plane {
  2.     private String name;
  3.     private int crew;
  4.     private int year;
  5.    
  6.     public String getName(){
  7.         return name;
  8.     }
  9.    
  10.     public int getYear(){
  11.         return year;
  12.     }
  13.    
  14.     public int getCrew(){
  15.         return crew;
  16.     }
  17.    
  18.     public void setName(String name){
  19.         this.name = name;
  20.     }
  21.    
  22.     public void setYear(int year){
  23.         this.year = year;
  24.     }
  25.    
  26.     public void setCrew(int crew){
  27.         this.crew = crew;
  28.     }
  29. }
  30.  
  31. public class Passenger extends plane{
  32.     private int people_amount;
  33.     private int people_max;
  34.    
  35.     Passenger(String name, int year, int crew, int people_amount,int people_max){
  36.         setName(name);
  37.         setYear(year);
  38.         setCrew(crew);
  39.         this.people_amount = people_amount;
  40.         this.people_max = people_max;
  41.     }
  42.    
  43.     int getPeople_amount(){
  44.         return people_amount;
  45.     }
  46.    
  47.     int getPeople_max(){
  48.         return people_max;
  49.     }
  50.    
  51. }
  52.  
  53. public class Cargo extends plane{
  54.     private double load;
  55.     private double max_load;
  56.    
  57.     Cargo(String name, int year, int crew,double load,double max_load){
  58.         setName(name);
  59.         setYear(year);
  60.         setCrew(crew);
  61.        
  62.         this.load = load;
  63.         this.max_load = max_load;
  64.     };
  65.    
  66.     double getLoad(){
  67.         return load;
  68.     }
  69.    
  70.     double getMax_load(){
  71.         return max_load;
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement