Commit 80162a0d authored by Martin Deinhofer's avatar Martin Deinhofer
Browse files

failure: class Course was not abstract

added examples for LabCourse and Webinar instantiation
parent 2f46046d
......@@ -6,7 +6,7 @@ package java_exercises3_1_1;
* @author mad
public class Course {
public abstract class Course {
private String name;
private int id;
package java_exercises3_1_1;
import java_exercises3_1_1.*;
......@@ -8,7 +11,7 @@ import java_exercises3_1_1.*;
public class TestUni {
public static void main(String[] args) {
public static void main(String[] args) throws MalformedURLException {
//Instantiate student called Martin
Student student=new Student("Martin",1);
University uni=new University();
......@@ -16,18 +19,27 @@ public class TestUni {
//Book Student Martin for the course Java Intro
Course course=new Course("Java Intro",1);
Course labCourse=new LabCourse("Java Intro",1, new String[]{"Exercise 1","Exercise 2"});
//From here we can't access the member variables of class Course because they are private.
//Let's try to book the course by a Student.;;
//Book Alumni Peter for course Java Intro
Alumni alumni=new Alumni("Peter");
//Also alumnis are allowed to book a course.;;
//But alumnis are not allowed to register. If you uncomment the follwing line you will get a compile error.
Course webinar=new Webinar("Java for Embedded",2,new URL(""));;;
//Existent courses
System.out.println("\nThe following courses exist:");
//Both alumnis and students implement the Attendee interface and hence provide a method called getName.
System.out.println("Name of Student: "+student.getName()+", Name of Alumni: "+alumni.getName());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment