Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
1139b17d66
@ -1,34 +1,34 @@
|
||||
package lab.three.one;
|
||||
|
||||
|
||||
public class Account
|
||||
{
|
||||
private double balance;
|
||||
public Account( double initialBalance )
|
||||
{
|
||||
|
||||
if ( initialBalance > 0.0 )
|
||||
balance = initialBalance;
|
||||
}
|
||||
|
||||
public void credit( double amount )
|
||||
{
|
||||
balance = balance + amount;
|
||||
}
|
||||
|
||||
public void debit(double amount ) {
|
||||
double newBalance = balance - amount;
|
||||
if (newBalance < 0) {
|
||||
System.out.println("Debit amount exceeds balance.");
|
||||
}
|
||||
else
|
||||
balance = newBalance;
|
||||
|
||||
}
|
||||
|
||||
public double getBalance()
|
||||
{
|
||||
return balance;
|
||||
}
|
||||
}
|
||||
|
||||
package lab.three.one;
|
||||
|
||||
|
||||
public class Account
|
||||
{
|
||||
private double balance;
|
||||
public Account( double initialBalance )
|
||||
{
|
||||
|
||||
if ( initialBalance > 0.0 )
|
||||
balance = initialBalance;
|
||||
}
|
||||
|
||||
public void credit( double amount )
|
||||
{
|
||||
balance = balance + amount;
|
||||
}
|
||||
|
||||
public void debit(double amount ) {
|
||||
double newBalance = balance - amount;
|
||||
if (newBalance < 0) {
|
||||
System.out.println("Debit amount exceeds balance.");
|
||||
}
|
||||
else
|
||||
balance = newBalance;
|
||||
|
||||
}
|
||||
|
||||
public double getBalance()
|
||||
{
|
||||
return balance;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user