first commit

This commit is contained in:
2019-08-13 12:23:06 -05:00
commit 916073f43b
337 changed files with 23253 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package Week2.Animals;
public class Animal {
protected String name;
public Animal(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String speak() {
return "";
}
@Override
public String toString() {
return "I am an animal called " + name;
}
}

View File

@@ -0,0 +1,17 @@
package Week2.Animals;
public class Cat extends Animal{
public Cat(String name) {
super(name);
}
@Override
public String speak() {
return "meow!";
}
@Override
public String toString() {
return "I am a cat and my name is " + name;
}
}

View File

@@ -0,0 +1,17 @@
package Week2.Animals;
public class Dog extends Animal{
public Dog (String name) {
super(name);
}
@Override
public String speak() {
return "woof!";
}
@Override
public String toString() {
return super.toString();
}
}

Binary file not shown.

View File

@@ -0,0 +1,18 @@
package Week2.InClassExercise1;
import java.util.ArrayList;
public class Course {
private ArrayList<Section> sections = new ArrayList<>();
private String prefix;
private int courseNumber;
public void display() {
}
@Override
public boolean equals(Object o) {
return false;
}
}

View File

@@ -0,0 +1,8 @@
package Week2.InClassExercise1;
public class Person {
private String name;
}

View File

@@ -0,0 +1,17 @@
package Week2.InClassExercise1;
import java.util.ArrayList;
public class Section {
private ArrayList<Person> students = new ArrayList<>();
private String classroom;
public int numStudents() {
return 0;
}
public void display() {
}
}

View File

@@ -0,0 +1,16 @@
package Week2.InClassExercise1;
import java.util.ArrayList;
public class Student {
private ArrayList<Integer> quizzes = new ArrayList<>();
public double quizAverage() {
return 0.0;
}
public void display(){
}
}

View File

@@ -0,0 +1,10 @@
package Week2.InClassExercise1;
public class Teacher extends Person {
public double salary;
public double calculateTaxes() {
return 0.0;
}
}

View File

@@ -0,0 +1,14 @@
package Week2;
import Week2.Animals.Animal;
import Week2.Animals.Cat;
public class InheritanceDriver {
public static void main(String[] args) {
Animal a = new Animal("Fred");
System.out.println(a);
Cat c = new Cat("Fluffy");
System.out.println(c);
}
}