Answers for "CodeHS Java 9.2.6 Students Part 1 StudentTester.java"

0

CodeHS Java9.2.6 Students Part 1 StudentTester.java

public class StudentTester
{
    public static void main(String[] args)
    {
        
        /**
         * Create a student in the class of 2020
         */
         Student bill = new Student("bill", 2020);
         
         /**
         * Create a student athlete in the class of 2022
         * that is eligible and plays soccer.
         */
         StudentAthlete robert = new StudentAthlete("robert", 2022, "soccer", true);
         
         // Print out both objects
    }
}
Posted by: Guest on April-20-2021
0

CodeHS Java9.2.6 Students Part 2 Student.java

public class Student
{
    private String name;
    private int classYear;
   
   // Constructor goes here
   public Student(String name, int year){
       this.name = name;
       this.classYear = year;
   }
   
    public String getName(){
       return name;
    }
   
    public int getClassYear(){
       return classYear;
    }
   
    public String toString(){
        return name + ", class of " + classYear;
    }
}
Posted by: Guest on April-20-2021
0

CodeHS Java9.2.6 Students Part 1 StudentTester.java

public class StudentTester
{
    public static void main(String[] args)
    {
        
        /**
         * Create a student in the class of 2020
         */
         Student bill = new Student("bill", 2020);
         
         /**
         * Create a student athlete in the class of 2022
         * that is eligible and plays soccer.
         */
         StudentAthlete robert = new StudentAthlete("robert", 2022, "soccer", true);
         
         // Print out both objects
    }
}
Posted by: Guest on April-20-2021
0

CodeHS Java 9.2.6 Students Part 3 StudentAthlete.java

public class StudentAthlete extends Student
{
    private String sport;
    private boolean eligible;
    
   public StudentAthlete(String name, int classYear, String sport, boolean eligible){
       super(name, classYear);
       this.sport = sport;
       this.eligible = eligible;
   }
   
   
   public String getSport(){
       return sport;
   }
   
   public boolean isEligible(){
       return eligible;
   }
    
    @Override
    public String toString(){
        return super.getName() + ", class of " + super.getClassYear() +
            ", plays " + sport;
    }
}
Posted by: Guest on April-20-2021
0

CodeHS Java9.2.6 Students Part 2 Student.java

public class Student
{
    private String name;
    private int classYear;
   
   // Constructor goes here
   public Student(String name, int year){
       this.name = name;
       this.classYear = year;
   }
   
    public String getName(){
       return name;
    }
   
    public int getClassYear(){
       return classYear;
    }
   
    public String toString(){
        return name + ", class of " + classYear;
    }
}
Posted by: Guest on April-20-2021
0

CodeHS Java 9.2.6 Students Part 3 StudentAthlete.java

public class StudentAthlete extends Student
{
    private String sport;
    private boolean eligible;
    
   public StudentAthlete(String name, int classYear, String sport, boolean eligible){
       super(name, classYear);
       this.sport = sport;
       this.eligible = eligible;
   }
   
   
   public String getSport(){
       return sport;
   }
   
   public boolean isEligible(){
       return eligible;
   }
    
    @Override
    public String toString(){
        return super.getName() + ", class of " + super.getClassYear() +
            ", plays " + sport;
    }
}
Posted by: Guest on April-20-2021

Code answers related to "CodeHS Java 9.2.6 Students Part 1 StudentTester.java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language