Question
What is the UML diagram for the Account class: import java.math.BigDecimal; import java.io.*; class Account{ private String name; private BigDecimal balance; public Account(String name,BigDecimal bal){
What is the UML diagram for the Account class:
import java.math.BigDecimal; import java.io.*; class Account{
private String name; private BigDecimal balance; public Account(String name,BigDecimal bal){ this.name=name; if(bal.doubleValue()>0.0) this.balance=new BigDecimal(bal.doubleValue());
} public void deposit(BigDecimal depositAmount){ if(depositAmount.doubleValue()>0.0){ balance = balance.add(depositAmount); } } public BigDecimal getBalance(){ return balance; } } public class Assignment{
public static void main(String[] args) { Account account = new Account("TestName",new BigDecimal("2000.1212")); System.out.println("Initial Balance : "+account.getBalance() ); //now we deposit 5000.212 account.deposit(new BigDecimal("5000.212")); System.out.println("New Balance : "+account.getBalance()); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started