Convert the following programs by implementing the concepts of encapsulation and modularity.
public class Account{
public double balance;
public Account(double x){
balance = x;
}
}
public class TestAccount{
public static void main(String[] args){
Account x = new Account(500.00);
//modify the account balance
x.balance = 550.00;
//withdraw 100.00 from the account
x.balance = x.balance – 100.00;
//deposit 250.00 to the account
x.balance = x.balance + 250.00;
//access the account balance
System.out.println(x.balance);
}
}
Answers
Answered by
0
cbsjbeyinestibvfruitwjjgsbii
Similar questions