Java_Tasks_Report (1)
Java_Tasks_Report (1)
Java Code
Employee() {
System.out.println("I am an employee");
salary = 30000;
}
void displayDetails() {
System.out.println("Name: " + name);
System.out.println("Position: " + position);
System.out.println("Years: " + years);
System.out.println("Salary: " + salary);
}
}
FulltimeEmployee() {
System.out.println("I am a full-time employee in the company");
}
void displayIncrementedSalary() {
System.out.println("Incremented Salary: " + (salary + (salary * increment)));
}
}
PartTimeEmployee() {
System.out.println("I am a part-time employee in the company");
}
void displayIncrementedSalary() {
System.out.println("Incremented Salary: " + (salary + (salary * increment)));
}
}
Accounts() {
balance = 0;
}
void getBalance() {
System.out.println("Current Balance: " + balance);
}
}
double calculateInterest() {
return balance * interestRate * timeSpan;
}
@Override
void credit(double amount) {
super.credit(amount);
double interest = calculateInterest();
balance += interest;
}
}
Expected Output
I am an employee
I am a full-time employee in the company
Name: John Doe
Position: Manager
Years: 5
Salary: 30000.0
Incremented Salary: 36000.0
I am an employee
I am a part-time employee in the company
Name: Jane Doe
Position: Assistant
Years: 2
Salary: 30000.0
Incremented Salary: 31500.0