Java Assignment 3: Exercise 1
Java Assignment 3: Exercise 1
Java Assignment 3: Exercise 1
JAVA ASSIGNMENT 3
Exercise 1:
Exercise 2:
Exercise 3:
a) Modify the Employee class add toStirng() method to represent the object
b) toString() method display id, name , salary, address
c) From main method instead of calling getter display the employee
object directly using System.out.println(empObj);
Exercise 4:
Exercise 5:
calculated as below.
(basicSalary * houseRentAllounce/100);
Exercise 6:
Exercise 7:
a) Create an abstract class Shape which is having the abstract function draw ().
b) Create three more sub classes from Shape which is Circle, Triangle , Line
c) Override the display method inside all three classes printing a message
d) For circle => “draw a circle” Triangle->” draw a triangle” Line=> draw Line
e) Create DrawTestclass with entry point main
f) Take input form user 1 to 3
g) Give option for user 1 for Circle , 2 for triangle , 3 for Line obj
// add code to get user input and create object of circle , triangle , Line
}
Classification: Internal
Exercise 8:
Exercise 9:
Exercise 10:
a) Modify the above hierarchy and replace the Account class with IAccount
interface
Classification: Internal
b) In the main method of AccountMain class add code that invokes the Saving
and Current account process using the IAcount reference
Exercise 11: