academic program class java 1

The AcademicProgram Class

The AcademicProgram class is what is called a super class.

  1. The attributes (use encapsulation)
    1. String name;
    2. int minimumNumberOfCredits;
    3. ArrayList<Course> requiredCourses;
  2. two constructors
    • one complete with all parameters, one for each attribute
    • one with no parameters
      • the default values should be
        • name – blank String (no spaces)
        • minimumNumberOfCredits – 0
        • requiredCourses – a new ArrayList<Course>
  3. a toString() method that will display information about the object
    • you can use the Netbeans automatic builder format
  4. The “get/set” methods
    • no special requirements.

The app Class

Create and display an AcademicProgram object with 3 courses (see below).

name: “Special Studies in Cyber Security”

minimumNumberOfCredits: 9

courses: 3 Course objects

  1. using the default/no parameter constructor
  2. using these values
    1. name – “Cyber”, “100”, “h”
    2. genEd – “IL” (the GenEd object returned with the find method in GenEdData)
    3. description – “Computer Systems Literacy”
    4. credits_min_per_course – 3
    5. credits_max_per_course – 9
    6. credits_maximum – 99
    7. preReq – use the default constructor for CourseName
    1. name – “CYBER”, “262”, “”
    2. genEd – “GS” (the GenEd object returned with the find method in GenEdData)
    3. description – “Cyber-Defense Studio”
    4. credits_min_per_course – 3
    5. credits_max_per_course – 9
    6. credits_maximum – 99
    7. preReq – “Cyber”, “100”, “”

Displaying

  • display the name and minimumNumberOfCredits
  • display each course in a single line
    • use the special string sequence “n” to add a new line to the display

Below a sample output (including part of the necessary code in app)

lab06_new_output.png

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *