Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a base abstract class Student and two derived classes OnlineStudent and InpersonStudent. Part 1: 10 pts Create an enum Year having the values
Create a base abstract class Student and two derived classes OnlineStudent and InpersonStudent. Part 1: 10 pts Create an enum Year having the values freshman, sophomore, senior, and junior. The class student should be abstract In base class student have the following private attributes: - firstName lastName year (of enum type Year). studentid (in format SS-XXXX) yearOfGraduation department courseFee And methods: +generateld() studentld should have the following format SS-XXXX First letter should be generated from first character of the firstName, second letter should be generated from the first character of lastName, followed by a -' and 4 random numbers. Eg. Abhishek Gaikwad might have id: AG-1234 (1234 generated randomly) toString() abstract method. Create appropriate constructors, getters, and setters for this base class Part 2: 5 pts Create a class called as InpersonStudent which extends Student. OnlineStudent has following attributes: - parkingFee numOfClasses semesterFee And the following methods. + calculateSemesterFee() - If the student has less or equal or equal to 3 classes then semesterFee = courseFee* numOfClasses + parkingFee. If a student has more than 3 classes, for every class above 3, the student receives a 20% off. Eg. the Student who has 5 classes, for the first 3 classes normal fee (courseFee) but the next two classes will be 20% off. A student can have a maximum of 5 classes. toString()-prints all information about that student. Create appropriate constructors, getters, and setters for this class. Part 3: 5 pts Create a class called OnlineStudent which extends Student. OnlineStudent has the following attributes: - numOfOnlineClasses // classes which student is taking online numOfInpersonClasses classes which student is taking inperson And the following methods: + calculateSemesterFee()- The logic to calculate fees for inperson classes is similar to that of calculateSemesterFee() of the InpersonStudent class. However, online classes are marked up by an additional 20%. So if the student has 3 online classes and 2 inperson classes. Inperson classes will cost (courseFee* numOfInpersonClasses) and online classes will cost = courseFee * 1.2* numOfOnlineClasses. A student can have a maximum of 5 classes. +toString() - prints all information about that student. Create appropriate constructors, getters, and setters for this class. Part 4: 10 pts Create a StudentTester, and test all the scenarios above Question4: UML Diagrams (20 pts): Draw UML Class diagrams for Q2 and Q3. Your diagram should include appropriate symbols and notations, associations, cardinality, constraints, composition, and aggregation wherever possible.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started