Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE DO IT WITHIN 30 MINUTES. I WILL UPVOTE. PLEASE DO IT WITHIN 30 MINUTES. I WILL UPVOTE. Instructions: You must upload the .java file(s)

PLEASE DO IT WITHIN 30 MINUTES. I WILL UPVOTE.

image text in transcribed

image text in transcribed

PLEASE DO IT WITHIN 30 MINUTES. I WILL UPVOTE.

Instructions: You must upload the .java file(s) as an assignment submission in Canvas. Late submission will not be allowed. The solution that you submit must be your own work. Plagiarism will lead to a straight zero. Question 01: Implement the following UML class diagrams which include an abstract class Employee, an interface TaxCalculator, and a child class Faculty. Employee - id: int - name : String - age: int > TaxCalculator + TAX_PERCENT, int = 15 + yearlyIncome Tax(): double + yearlyIncome Without Tax(): double + Employee (id: int, name : String, age :int) + Getters + Setters + yearlySalaryo: int l'abstract + yearlyIncome(): int llabstract Faculty - initial : String - monthly Salary: int -yearlyBonus : int + Faculty (id:int, name : String, age : int. initial: String, monthly Salary: int, yearlyBonus : int) + Getters + Setters + toString: String Now write a test program that performs the following tasks: 1. Create a Faculty object with an id of 1001, name as Gareth Bale, age of 43 years, initial as GB, the monthly salary of 30000 BDT, the yearly bonus of 40000 BDT. 2. Call the toString() method of the Faculty class where yearlySalary,yearlyIncome, yearlyIncome Tax, yearlyIncome WithoutTax are included. In console: Faculty [initial=GB, monthlySalary=30000, yearlyBonus=40000, yearlySalary=360000, yearlyIncome=400000, yearlyIncome Tax=60000.0, yearlyIncomeWithout Tax=340000.0] 3. Now modify the Faculty class in such a way so that objects can't be created with a negative yearly bonus. If any Faculty object is created with a negative yearly bonus, it'll throw an exception such as IllegalArgumentException with an appropriate error message like "Yearly bonus can't be negative". 4. Create another Faculty object with an id of 1002, name as lan Goodfellow, age of 46 years, initial as IGF, the monthly salary of 30000 BDT, the yearly bonus of - 40000 BDT. 5. Then catch with an appropriate error message, if any exception occurs here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions