Question: CODE IN JAVA Lab6.java import java.util.*; public class Lab6{ public static void main(String[] args){ ArrayList students = new ArrayList(); students.add(new Undergraduate(Woody, 36, 3-year ACS)); students.add(new

CODE IN JAVA

CODE IN JAVA Lab6.java import java.util.*; public class Lab6{ public static void

Lab6.java

import java.util.*;

public class Lab6{ public static void main(String[] args){ ArrayList students = new ArrayList(); students.add(new Undergraduate("Woody", 36, "3-year ACS")); students.add(new Graduate("Buzz", 18, false)); students.add(new Graduate("Rex", 6, true)); students.get(0).addCreditHours(3); students.get(1).addCreditHours(3); for (Student s : students) System.out.println(s + ", " + s.getRemainingCreditHours()+ " course credit hours remaining"); } }

ACS has both Undergraduate and Graduate programs. Undergraduate students may choose a 4-year degree (120 credit hours) or a 3-year degree (90 credit hours). Graduate students may choose to follow a course- based (30 credit hours of courses) or thesis-based (12 credit hours of courses) program. > Student Graduate Undergraduate Create the following classes according to the UML diagram above, the code in the class Lab6.java, and the sample output below. Student has the fields name and creditHours (the number of credit hours the student currently has), and the abstract method getRemainingCreditHours that returns an integer of how many credit hours the student has left in their program. Graduate has boolean isthesis (true if thesis-based, false if course-based). Undergraduate has a string prog indicating the program ("3-year ACS" or "4-year ACS"). Include a no-arg constructor and the constructor(s) required (see main method in the Lab6 class). Include any methods required for Lab6 to produce the given output. Your classes should minimize duplicate code. When testing, do NOT change the code in the driver class. For grading, your code will run with the given Lab6.java file, so it must work with that. Sample output: Woody, 3-year ACS, 51 course credit hours remaining Buzz, course-based Masters, 9 course credit hours remaining Rex, thesis-based Masters, 6 course credit hours remaining

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!