0% found this document useful (0 votes)
13 views

Aldea Quilang UML

The document describes a UML class diagram for a simple banking system with Account, SavingsAccount and CheckingAccount classes. The Account class is the superclass with attributes like accountNumber and balance and methods deposit() and withdraw(). SavingsAccount has an additional attribute interestRate and method calculateInterest(). CheckingAccount has an additional attribute overdraftLimit and method setOverdraftLimit().

Uploaded by

nicole quilang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Aldea Quilang UML

The document describes a UML class diagram for a simple banking system with Account, SavingsAccount and CheckingAccount classes. The Account class is the superclass with attributes like accountNumber and balance and methods deposit() and withdraw(). SavingsAccount has an additional attribute interestRate and method calculateInterest(). CheckingAccount has an additional attribute overdraftLimit and method setOverdraftLimit().

Uploaded by

nicole quilang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Exercise1: Create the equivalent UML class diagram

class Person { class Student extends Person { class Teacher extends Person {
protected String name; private int marks; private int salary;
protected int age; public void public void
public void setStudentDetails(String s_name, setTeacherDetails(String t_name,
setPersonDetails(String p_name, int s_age, int s_marks) { int t_age, int t_salary) {
int p_age) { setPersonDetails(s_name, s_age); setPersonDetails(t_name, t_age);
name = p_name; marks = s_marks; salary = t_salary;
age = p_age; } }
} public void getStudentDetails() { public void getTeacherDetails() {
public void getPersonDetails() { System.out.println("#### System.out.println("####
System.out.println("Name: " + Details of student ####"); Details of teacher ####");
name); getPersonDetails(); getPersonDetails();
System.out.println("Age: " + System.out.println("Marks: " + System.out.println("Salary: " +
age); marks); salary);
} } }
} }

Person

# name: String
# age: int
+ setPersonDetails (p_name: String,
p_age: int): void
+ getPersonalDetails (): void

Student Teacher

- marks: int - salary: int

+ setStudentDetails (s_name: String, + setTeacherDetails (t_name: String,


s_age: int, s_mark: int): void t_age: int, t_salary: int): void
+ getStudentDetails(): void + getTeacherDetails(): void
Exercise 2: Create a UML class diagram for a simple banking system with the following classes: Account,
SavingsAccount, and CheckingAccount. The Account class should be the superclass of both
SavingsAccount and CheckingAccount.

Requirements:

The Account class should have attributes such as accountNumber and balance, along with
methods like deposit() and withdraw().

The SavingsAccount class should have an additional attribute called interestRate and a method
called calculateInterest().

The CheckingAccount class should have an additional attribute called overdraftLimit and a
method called setOverdraftLimit().

Account

# accountNumber: int
# balance: int

<<constructor>>
+ Account (accountNumber: int)
+ deposit (d_Amount: double): void
+ withdraw (w_Amount: double):
void

SavingsAccount CheckingAccount

# interestRate: double # overdraftLimit: double

<<constructor>> <<constructor>>
+ SavingsAccount(accountNumber: + CheckingAccount (accountNumber:
int, interestRate: double) int, overdraftLimit: double)
+ calculateInterest (): double + setOverdraftLimit (limit: double):
void

You might also like