filmov
tv
java how to program exercise 3.12
Показать описание
java how to program exercise 3.12
public class AccountTest {
public static void main(String[] args) {
Account account1 = new Account(50.00);
Account account2 = new Account(-7.53);
double depositAmount;
double debitamount;
}
}//end class
class Account {
private double balance;
public Account(double initialBalance) {
if (initialBalance (user greater sign here) 0.0) {
balance = initialBalance;
}
}
public void credit(double amount) {
balance = balance + amount;
}
public void debit(double amount)
{
if(amount(user less than sign here)balance)
{
balance = balance-amount;
}
else
{
}
}
public double getBalance() {
return balance;
}
}
public class AccountTest {
public static void main(String[] args) {
Account account1 = new Account(50.00);
Account account2 = new Account(-7.53);
double depositAmount;
double debitamount;
}
}//end class
class Account {
private double balance;
public Account(double initialBalance) {
if (initialBalance (user greater sign here) 0.0) {
balance = initialBalance;
}
}
public void credit(double amount) {
balance = balance + amount;
}
public void debit(double amount)
{
if(amount(user less than sign here)balance)
{
balance = balance-amount;
}
else
{
}
}
public double getBalance() {
return balance;
}
}