Problem 3: id: String name: String balance: double Account + Account (id: String, name: String) + Account (id: String, name: String, balance: int). + getId(): String + getName(): String + getBalance(): double + credit (amount: double): void + debit (amount: double): boolean + transfer To (another: Account, double amount) : void + account Details(): String Given the UML diagram above, create a java class named Account, the methods in the Account class perform the following tasks: credit (): Adds the value of the argument amount to the balance. debit(): Subtracts the value of the argument amount from the balance and returns true, if no enough funds are available, the method prints "Amount exceeded", then returns false. transferTo(): Transfers funds from this Account object to the parameter Account object, the amount of the transfer should be equal to the value of the argument amount. Make sure the transfer does not cause an overdraft. Hint: Take advantage of the debit () method you just completed. If the transfer was successfully completed, the method prints "Transfer completed", otherwise the method prints "Amount exceeded".
Problem 3: id: String name: String balance: double Account + Account (id: String, name: String) + Account (id: String, name: String, balance: int). + getId(): String + getName(): String + getBalance(): double + credit (amount: double): void + debit (amount: double): boolean + transfer To (another: Account, double amount) : void + account Details(): String Given the UML diagram above, create a java class named Account, the methods in the Account class perform the following tasks: credit (): Adds the value of the argument amount to the balance. debit(): Subtracts the value of the argument amount from the balance and returns true, if no enough funds are available, the method prints "Amount exceeded", then returns false. transferTo(): Transfers funds from this Account object to the parameter Account object, the amount of the transfer should be equal to the value of the argument amount. Make sure the transfer does not cause an overdraft. Hint: Take advantage of the debit () method you just completed. If the transfer was successfully completed, the method prints "Transfer completed", otherwise the method prints "Amount exceeded".
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%

Transcribed Image Text:accountDetails(): Returns a String that contains the Account id,
name and balance in the following format:
the current balance in your account S93203 is $2934.31
John,
Where John is the name, S93203 is the account id and 2934.31 is the balance.
Your output should look exactly the same as follows:
S93203
John
2534.31
Amount exceeded
2534.31
2334.31
John, the current balance in your account S93203 is $2934.31
Amount exceeded
Transfer completed
John, the current balance in your account S93203 is $2434.31
Sarah, the current balance in your account C45442 is $840.97

Transcribed Image Text:Problem 3:
id: String
- name: String
balance: double
Account
+ Account (id: String, name: String)
+ Account (id: String, name: String, balance: int)
+ getId(): String
+ getName(): String
+ getBalance(): double
+ credit (amount: double): void
+ debit (amount: double): boolean
+ transfer To (another: Account, double amount) : void
+ account Details(): String
Given the UML diagram above, create a java class named Account, the methods
in the Account class perform the following tasks:
credit(): Adds the value of the argument amount to the balance.
debit(): Subtracts the value of the argument amount from the balance
and returns true, if no enough funds are available, the method prints
"Amount exceeded", then returns false.
transferTo(): Transfers funds from this Account object to the parameter
Account object, the amount of the transfer should be equal to the value of
the argument amount.
Make sure the transfer does not cause an overdraft. Hint: Take advantage
of the debit () method you just completed.
If the transfer was successfully completed, the method prints "Transfer
completed", otherwise the method prints "Amount exceeded".
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 4 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY