Objected Oriented Programming
Exception Handling
Create an EmployeeException class whose constructor receives a String that consists of an Employee’s ID and pay rate. Create an Employee class with two fields, IDNum and hourlyWage. The Employee constructor requires values for both fields. Upon construction, throw an EmployeeEception if the hourlyWage is less than 6.00 or over 50.00. Write a test program (containing main method) that establishes at least three employees with hourlyWages that are above, below, and within the allowed range.
class EmployeeException extends Exception
{
EmployeeException(String IDPayRate)
{
super(IDPayRate);
}
}
class Employee
{
int IDNum;
double hourlyWage;
Employee(int IDNum,double hourlyWage)
{
this.IDNum=IDNum;
if(hourlyWage>50.00 || hourlyWage<6.00)
{
try
{
throw new EmployeeException(IDNum+" "+hourlyWage+"\n");
}
catch(EmployeeException e1)
{
System.out.println(e1);
}
}
else
{
this.hourlyWage=hourlyWage;
}
}
void employeeInfo()
{
System.out.println("Employee's ID : "+IDNum);
System.out.println("Employee's Hourly wages : "+hourlyWage);
}
}
class Test
{
public static void main(String args[])
{
System.out.println("HourlyWages that are above : ");
Employee e1=new Employee(1,60.00);
System.out.println("HourlyWages that are below : ");
Employee e2=new Employee(2,5.00);
System.out.println("HourlyWages that are within the allowed range :
\n");
Employee e3=new Employee(3,25.00);
e3.employeeInfo();
}
}

Note :Taken employeeInfo() method for more understanding
Objected Oriented Programming Exception Handling Create an EmployeeException class whose constructor receives a String that consists...
JAVA PROGRAMMING Create an Employee class which implements Comparable<Employee> The constructor consists of an employee’s first name and an employee’s salary, both of which are instance variables. Create accessor and mutator methods for both of these variables Write an equals method that returns true if the salaries are equal with one cent and the names are exactly equal Write a compareTo method that returns 1 if the salary of this employee is greater than the salary of the comparable, -1...
C++ edit: You start with the code given and then modify it so that it does what the following asks for. Create an EmployeeException class whose constructor receives a String that consists of an employee’s ID and pay rate. Modify the Employee class so that it has two more fields, idNum and hourlyWage. The Employee constructor requires values for both fields. Upon construction, throw an EmployeeException if the hourlyWage is less than $6.00 or over $50.00. Write a program that...
Advanced Object-Oriented Programming using
Java
Assignment 4: Exception Handling and Testing in
Java
Introduction - This assignment is
meant to introduce you to design and implementation of
exceptions in an object-oriented language. It will
also give you experience in testing an
object-oriented support class.
You will be designing and implementing a version of the game
Nim. Specifically, you will design and implement a
NimGame support class that stores all actual
information about the state of the game, and detects and throws...
Amusement Park Programming Project Project Outcomes Use the Java selection constructs (if and if else). Use the Java iteration constructs (while, do, for). Use Boolean variables and expressions to control iterations. Use arrays or ArrayList for storing objects. Proper design techniques. Project Requirements Your job is to implement a simple amusement park information system that keeps track of admission tickets and merchandise in the gift shop. The information system consists of three classes including a class to model tickets, a...
In a new file located in the same package as the class Main, create a public Java class to represent a photograph that consists of a linear (not 2D) array of pixels. Each pixel is stored as an integer. The photograph class must have: (a) Two private fields to represent the information stored about the photograph. These are the array of integers and the date the photograph was taken (stored as a String). The values in the array must be...