Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions