You are on page 1of 1

Assignment-OOP

Max Marks: 50

Weightage:6% Date of Submission: 25 March,2020

1. Create a class named Employee with the following attributes and behaviour:
 3 fields: name(String), hours_worked(int) and salary(double)
 Default constructor: hours_worked=0, salary=0, name=”no name”.
 Create a method named “Validator” that validates whether the string that saves name
contains alphabets only, no numbers.
 Hint: (validate textbox values when the user enters by applying textchanged event
before submitting the form and display an error message of red color on the label).
 Create a method called calculateSalary that calculate the salary and return double value.
Salary/day=hours_worked*Salary/hour
 In the form generate an object of Employee class called accountant.
 Validate all the values as mentioned in step 3.
 If there are no validation errors. Get the values of all the fields from the textboxes.
Calculate the salary and display the result on message box. (10 Marks)
2. Design and implement a set of classes that define a series of three dimensional geometric
shapes. For each shape, store fundamental data about its size and provides methods to access
and modify the data. In addition, provide appropriate methods to compute each shape’s
circumference, area and volume. In your design consider how shapes are related and thus when
inheritance can be implemented. Create a form to instantiate and exercise several of the
classes. (20 Marks)

3. Create a class named Employee that can be used to calculate the salaries of different
employees. The Employee class should keep a track of the employee ID, name,
department, salary, and designation with appropriate accessor and mutator methods.

Next, create two additional classes named Manager and Clerk that are derived from
Employee. Create an overridden method named addBonus that returns the salary of the
employee after adding up the bonus. There is a default bonus of $200/month. Managers
have a bonus of $300/month and clerks have a bonus of $100/month.

Finally create a display method to print the details of the employee. You may assume the
initial salary of an employee and other necessary values. Test your classes. (20 Marks)

You might also like