For problems 10 - 17, we will be referring to the following Account class definition, public class Account { private int
Posted: Mon May 09, 2022 6:31 am
11. fill in the blacnk so the if statement prints "same" if sal
and jen have the same balance
if(___________________________________)
system.out.println("same");
12. write a statement to assign a balance of $3000.00 to jen;s
account.
13. write a statement to add $500 to sal's balance, using only
the set and get methods and the technique of compositions
For problems 10 - 17, we will be referring to the following Account class definition, public class Account { private int account Number; private double balance; public Account() { this.account Number = 0; this.balance = 0.0; } public Account(int accountNumber, double balance) { this account Number = account Number; this.balance = balance; } public double getBalance() { return this.balance; } public void setBalance (double balance) { this.balance = balance; } public double getAccount Number() { return this account Number; } public void setAccount Number(int account Number) { this.account Number = account Number; } Also, suppose in a main method somewhere, you have created the following objects: Account sal = new Account (12345, 1500.00); Account jen = new Account(54321, 2000.00); 10. Write a statement to print only sal's account number
and jen have the same balance
if(___________________________________)
system.out.println("same");
12. write a statement to assign a balance of $3000.00 to jen;s
account.
13. write a statement to add $500 to sal's balance, using only
the set and get methods and the technique of compositions
For problems 10 - 17, we will be referring to the following Account class definition, public class Account { private int account Number; private double balance; public Account() { this.account Number = 0; this.balance = 0.0; } public Account(int accountNumber, double balance) { this account Number = account Number; this.balance = balance; } public double getBalance() { return this.balance; } public void setBalance (double balance) { this.balance = balance; } public double getAccount Number() { return this account Number; } public void setAccount Number(int account Number) { this.account Number = account Number; } Also, suppose in a main method somewhere, you have created the following objects: Account sal = new Account (12345, 1500.00); Account jen = new Account(54321, 2000.00); 10. Write a statement to print only sal's account number