The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 337 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
help! test code provided by teacher is attached along with the starting code
import java.util.*;
import java.io.*;
/**
* A bank account has a balance and a mechanism for applying interest or fees at
* the end of the month. TODO: Implement the Formattable interface
*/
public class BankAccount
{
private double balance;
/**
* Constructs a bank account with zero balance.
*/
public BankAccount()
{
balance = 0;
}
/**
* Constructs a bank account with a given balance.
*/
public BankAccount(double amount)
{
balance = amount;
}
/**
* Makes a deposit into this account.
*
* @param amount the amount of the deposit
*/
public void deposit(double amount)
{
balance = balance + amount;
help! test code provided by teacher is attached along with the starting code
}
/**
* Makes a withdrawal from this account.
*
* @param amount the amount of the withdrawal
*/
public void withdraw(double amount)
{
balance = balance - amount;
}
/**
* Gets the current balance of this bank account.
*
* @return the current balance
*/
public double getBalance()
{
return balance;
}
//TODO: Your work goes here
/**
* Some quick self-tests to see if you've done the
* formatting correctly.
* @param args
*/
public static void main(String[] args)
{
BankAccount account1 = new BankAccount(1000);
BankAccount account2 = new BankAccount(55);
BankAccount account3 = new BankAccount(345);
BankAccount account4 = new BankAccount(99000);
System.out.printf( "Actual : |%10s|%10s|%10s|%10s|%n", account1, account2, account3, account4);
System.out.println("Expected: | 1000.0| 55.0| 345.0| 99000.0|");
}
}
----------- ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly