Question
Read the following scenario, and help the programmers to develop a code without any errors and display appropriate warning messages: Scenario: Code running on the
Read the following scenario, and help the programmers to develop a code without any errors and display appropriate warning messages:
Scenario:
Code running on the real time live application, without proper exception handling is nightmare for developers. It might be any type of application from simple to complex. When exception handling is in place you can easily point out the pain area of application and resolve the issue.
ABC Company deals with employee wages and calculates the total salary for employees. Sometimes, knowing or unknowingly, data entry mistake has been made by the data entry operator. As a Java developer you are asked to fix the bug and display the proper warning message to the data entry operator if he/she makes mistakes in entering.
Declare a class Weekly_Wages with the following properties.
Employee_Id stores employee id in number format - integer Employee_Name stores employee name in text format - string Days Number of days employee actually in a week - integer Weekly_Wages [] An double array for maximum 7 inputs as wages Total Find the total wages - Double
Formula:
Total_wages = (Summation of weekly wages)
Expected Output:
Employee Id :
Employee Name: Total Wages: ________
Possible Wrong Data entry cases, catch the respective errors and display proper warning message. Case 1:Employee_Id should be a number whereas dataentry made as E2016727 which caused the error
Case 2: Maximum number of days (Days) is Seven in a week, whereas user entered number of days more than 7 which caused an error
Rubric
a) Design the Weekly_Wages class
b) Display the expected output for the proper data entry
c) Case 1: Design the Code statement to fix error and display the warning message
d) Case 2: Design Code statement to fix error and display the warning message
e) Integrate the whole program and overall program
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