Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java question inology CS415 Contemporary Programming Techniques if the value of sal is First Semester - 2020/2021 less than zero. Otherwise, it sets the salary

image text in transcribed

Java question

inology CS415 Contemporary Programming Techniques if the value of sal is First Semester - 2020/2021 less than zero. Otherwise, it sets the salary attribute to sal. You should change the method signature to include the corresponding throws expression. Section: Implement the following UML class diagram in Java. Name: public Employee (String name double salary ii.) LeralidSalanception Employee ame: Sing salary: double Employee String scele sealedoblet ved This constructor initializes the class attributes this.name and this.salary appropriately. invalid Salary Esceptian Invalid Sales Exception Spring) 1. Implement a user defined exception class called InvalidsalaryException. The class must have two constructors, a constructor that takes no parameters, and a constructor that takes a string message. These constructors should call the corresponding constructors from the class java.lang.Exception. Implement a main method in the class Employee, as follows: a. Add a try-catch-finally blocks. The try block must include the following statements: 1. Create and instantiate an object of type Employee. 2. Call the method setSalary() on the object, where the actual parameter is 400. 2. Implement the class Employee, as follows: 1 public void setelars doable sal This method thousan InvalidSalazyException b. The catch block should catch InvalidSalaryException, and should call ther method printStackTrace()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions