lab task 2
lab task 2
private ProductManager() {}
@Override
public String toString() {
return "Name: " + name + ", Price: " + price + ", Category: " + getCategory();
}
}
// Subclasses
class Electronics extends Product {
public Electronics(String name, double price) {
super(name, price);
}
@Override
public String toString() {
return "ID: " + id + ", Name: " + name + ", Role: " + getRole();
}
}
// Subclasses
class Student extends Person {
private String grade;
// Manager Class
class SchoolManager {
private List<Person> people = new ArrayList<>();
Task for Student: Add a module to allow filtering people based on their role or additional attributes
(e.g., list all students of a specific grade). Use the oop concept. Singletone and factory method is not
necessary
@Override
public String toString() {
return "Account Number: " + accountNumber + ", Balance: " + balance + ", Type: " +
getAccountType();
}
}
// Subclasses
class SavingsAccount extends BankAccount {
public SavingsAccount(String accountNumber, double balance) {
super(accountNumber, balance);
}
// Manager Class
class BankManager {
private List<BankAccount> accounts = new ArrayList<>();
Task for Student: Add a module for calculating interest for SavingsAccount and overdraft facilities
for CurrentAccount. You can use oop concept or the design pattern concept here.
ID---------------------------------------Task NO
432220005191002 1
432220005191004 2
432220005191005 3
432220005191006 1
432220005191007 3
432220005191008 2
432220005191009 3
432220005191010 1
432220005191011 2
432220005191012 1
432220005191017 2
432220005191018 3
432310005191002 2
432310005191003 1
432310005191004 3
432310005191006 3
432310005191009 2
432310005191010 1
432310005191011 1
432310005191012 2
1914555032 3
1914555036 1
2044855003 2
2114955003 3
2114955004 2
2114955005 3
2114955007 1
2114955011 1
2215155003 2
2215155017 3
1914555009 1
1914555014 2