Create the classes described below Use meaningful class vari

Create the classes described below. Use meaningful class variables and functions. All class variable are to be declared private, but class functions are public. Each class need to have at least two constructors.

Solution

Team Class

public class Team {

//variables

private String name;

private String city;

// Parameterized constructor

public Team(String name, String city) {

super();

this.name = name;

this.city = city;

}

// default constructor

public Team(){

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getCity() {

return city;

}

public void setCity(String city) {

this.city = city;

}

}

-----------------------------------------------------------------------------------------------------------------------------------------------------

NBATeam Class

public class NBATeam extends Team {

   //variables
   private int championships;

   // default constructor
   public NBATeam() {
       super();
   }

   // parameterized constructor
   public NBATeam(String name, String city, int championships) {
       super(name, city);
       this.championships = championships;
   }

   public int getChampionships() {
       return championships;
   }

   public void setChampionships(int championships) {
       this.championships = championships;
   }
      
}

---------------------------------------------------------------------------------------------------------------------------------------------------

Person Class

public class Person {

private String name;

private int birthYear;

public Person(String name, int birthYear) {

super();

this.name = name;

this.birthYear = birthYear;

}

public Person(){

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getBirthYear() {

return birthYear;

}

public void setBirthYear(int birthYear) {

this.birthYear = birthYear;

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

Student Class

public class Student extends Person {

private String major;

public Student() {

super();

}

public Student(String name, int birthYear, String major) {

super(name, birthYear);

this.major = major;

}

public String getMajor() {

return major;

}

public void setMajor(String major) {

this.major = major;

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

Company Class

public class Company {

private String location;

public Company(String location) {

super();

this.location = location;

}

public Company() {

}

public String getLocation() {

return location;

}

public void setLocation(String location) {

this.location = location;

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

TechCompany Class

public class TechCompany extends Company {

private String companyName;

public TechCompany(String location, String companyName) {

super(location);

this.companyName = companyName;

}

public TechCompany() {

}

public String getCompanyName() {

return companyName;

}

public void setCompanyName(String companyName) {

this.companyName = companyName;

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

Animal Class

public class Animal {

private float weight;

public Animal(float weight) {

super();

this.weight = weight;

}

public Animal(){

}

public float getWeight() {

return weight;

}

public void setWeight(float weight) {

this.weight = weight;

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

Mammal Class

public class Mammal extends Animal {

   private int heartRate;
  
   public Mammal(float weight, int heartRate) {
       super(weight);
       this.heartRate = heartRate;
   }

   public Mammal() {
      
   }

   public int getHeartRate() {
       return heartRate;
   }

   public void setHeartRate(int heartRate) {
       this.heartRate = heartRate;
   }

}

------------------------------------------------------------------------------------------------------------------------------------

Reptile Class

public class Reptile extends Animal {

private int genusIndex;

public Reptile(float weight, int genusIndex) {

super(weight);

this.genusIndex = genusIndex;

}

public Reptile() {

}

public int getGenusIndex() {

return genusIndex;

}

public void setGenusIndex(int genusIndex) {

this.genusIndex = genusIndex;

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

Snake Class

public class Snake extends Reptile {

private int age;

private boolean isMale;

public Snake(float weight, int genusIndex, int age, boolean isMale) {

super(weight, genusIndex);

this.age = age;

this.isMale = isMale;

}

public Snake() {

}

public int getAge() {

return age;

}

public void setAge(int age) {

this.age = age;

}

public boolean isMale() {

return isMale;

}

public void setMale(boolean isMale) {

this.isMale = isMale;

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

Fish Class

public class Fish extends Animal {

public static enum WaterType {freshWater, saltWater};

private WaterType myWater;

public Fish(float weight, WaterType myWater) {

super(weight);

this.myWater = myWater;

}

public Fish() {

}

public WaterType getMyWater() {

return myWater;

}

public void setMyWater(WaterType myWater) {

this.myWater = myWater;

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

Shark Class

public class Shark extends Fish {

public Shark(float weight, WaterType myWater) {

super(weight, myWater);

}

public Shark() {

}

}

---------------------------------------------------------------------------------------------------------------------------------------------------

 Create the classes described below. Use meaningful class variables and functions. All class variable are to be declared private, but class functions are public
 Create the classes described below. Use meaningful class variables and functions. All class variable are to be declared private, but class functions are public
 Create the classes described below. Use meaningful class variables and functions. All class variable are to be declared private, but class functions are public
 Create the classes described below. Use meaningful class variables and functions. All class variable are to be declared private, but class functions are public
 Create the classes described below. Use meaningful class variables and functions. All class variable are to be declared private, but class functions are public
 Create the classes described below. Use meaningful class variables and functions. All class variable are to be declared private, but class functions are public
 Create the classes described below. Use meaningful class variables and functions. All class variable are to be declared private, but class functions are public

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site