Package angry3vilbot.bankingapp
Class Jar
java.lang.Object
angry3vilbot.bankingapp.Jar
Jar class represents a savings jar with an ID, title, goal amount, and current balance.
It provides constructors to initialize the jar with or without a goal amount.
It also provides getter methods to access the jar's properties.
-
Field Details
-
id
private int idID of the jar -
title
Title of the jar -
goal
private double goalGoal amount for the jar (optional) -
balance
private double balanceCurrent balance of the jar
-
-
Constructor Details
-
Jar
Constructs a Jar object with the specified ID, title, goal, and balance.- Parameters:
id- the ID of the jartitle- the title of the jargoal- the goal amount for the jarbalance- the current balance of the jar
-
Jar
Constructs a Jar object with the specified ID, title, and balance but without a goal.- Parameters:
id- the ID of the jartitle- the title of the jarbalance- the current balance of the jar
-
-
Method Details
-
getId
public int getId()Gets the ID of the jar.- Returns:
- the ID of the jar
-
getTitle
Gets the title of the jar.- Returns:
- the title of the jar
-
getGoal
public double getGoal()Gets the goal amount of the jar.- Returns:
- the goal amount of the jar
-
getBalance
public double getBalance()Gets the current balance of the jar.- Returns:
- the current balance of the jar
-