Problem 1. Implement a class called BonusTooLowException, designed to be thrown when a bonus value is less than $2000. U

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Problem 1. Implement a class called BonusTooLowException, designed to be thrown when a bonus value is less than $2000. U

Post by answerhappygod »

Problem 1. Implement a class called BonusTooLowException,
designed to be thrown when a
bonus value is less than $2000. Using the Executive class from
Chapter 10, create a main
program that creates and populates an Executive array with
information entered by the user
(array size as well). If a bonus value is entered that is too low,
i.e. less than $2000 throw the
exception. Allow the thrown exception to terminate the
program.
Problem 2. Modify the solution to the program above (submit a
second file for this) such that it
catches and handles the exception if it is thrown. Handle the
exception by printing an
appropriate message and keeping the bonus=0, and then continue
entering more executive data.
Let the program conclude by printing the total number of executives
with valid bonuses, i.e.
positive, more than $2000, as well as the average pay.
NOTE: These problems do not require use of all the classes from
Chapter 10.
Since Executive is a child of Employee, StaffMember, you can copy
the classes needed to your
homework folder.
Since exception handling process is different for each problem,
submit two separate driver
programs in addition to BonusTooLowException file.
Submit only 4 files: Executive.java + BonusTooLowException.java
+ MainThrow.java + MainCatch.java
Please use java language
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply