by java
this is BankAccount.java
this is BankAccount01_Testing.java
this is BankAccount02_Testing.java
1999 Exercise 4: (2 points) Project Name Instruction :
_LABO5_BankAccount : Download BankAccount.java from Google Classroom and complete a BankAccount class in the following tasks. a) Create a Developer package and put BankAccount.java in this package. Put appropriate keywords and visibility modifiers (static, private, and public) in the program below so that it fulfils the following requirements. 1. numAccount keeps the number of BankAccount objects that has been created. The numAccount must be accessible anywhere. 2. owner Name, and balance variables can only be accessed inside of the BankAccount class, but not anywhere else. 3. account Number can only be accessed inside of the package Developer, but not anywhere else. 4. deposit methods must be accessible anywhere, and withdraw methods can only be accessed from any class on the same package or outside of the package for its subclass 5. printInfo method can only be accessed inside of the BankAccount class and within the package Developer, but not anywhere else. package Developer; public class BankAccount { // String ownerName; 11 account Number; double balance; // int numAccount; 17 balance) { BankAccount(String owner Name, String accountNumber, double this.ownerName = ownerName; this.accountNumber = account Number; this.balance = balance; numAccount++; 3 void deposit (double amount) { balance - balance + amount; System.out.println("Deposit: $"+amount); 3 void withdraw(double amount) { if (balance > amount) { balance = balance - amount; System.out.println("Withdraw: $"+amount): }else { System.out.println("Not enough balancel"); } ) 3 2. Exercise 5: (2 points) Project Name Instruction : _LABO5_BankAccount : Download BankAccount01_Testing.java and BankAccount02_Testing java from Google Classroom and complete the following tasks. a) Put BankAccount.java in the Developer package, and answer in the following questions: Exercise 5-a-1 and Exercise 5-a-2. package Developer; public class BankAccounti_Testing public static void main(String[] args) { BankAccount account1 = new BankAccount ("Paris Hilton", "127-983-3847", 1000eee.ee); 1/System.out.println("The balance of accounti is $" + account1.balance); //deposit $300 for accounti //print out the balance of accounti Exercise 5-a-1 //System.out.println("The balance of accounti is $" + accounti.balance); Uncomment the above code and run this Java project. If students put appropriate keywords and visibility modifiers in the Exercise 4-a correctly, you MUST NOT be able to run this code line in this Exercise 5-a-1. Do you know the reason why? * Explain your TA to get the point on this problem, and Explain your answer Exercise 5-a-1 in a comment of the Google Classroom as shown at below figure: STUDENT NAME Tuese Explain your reason in a comment of Goyle Classroom Student ABS Bike Cornpressed Archive vercise 5 : The son why this codo unable to furt Exercise 5-a-2 //deposit $300 for accounti Use the dot operator to call the deposit method to add $300 into the accounti. //print out the balance of accounti Apply the Encapsulation concept to solve the problem in Exercise 4-b-1 and print out the balance of accounti. Your running output should be as below: Deposit: $300.0 The balance of accountl is $1000300.0 Do you know the reason why? * Explain your TA to get the point on this problem, and * Explain your answer Exercise 5-a-2 in a comment of the Google Classroom as shown at below figure: STUDENT_NAME Tumed in See history Explain your reason in a comment of Google Classroom II Student-ID LARS Blank Compressed Archive Exercise 3 a The reason why this code unable to runis b) Put BankAccount02_Testing java in the outside package, and complete the answer in the following question: Exercise 5-b-1 and Exercise 5-b-2, package Outside; import Developer.BankAccount; public class BankAccount2_Testing { public static void main(String [] args) { BankAccount account new BankAccount ("Paris Hilton","127-983-3847", 10000ee.ee ); //account2.printInfo(); //account2.withdraw(300.00); //System.out.println("The balance account 2. balance); of accounti is $" + Exercise 5-b-1 //account2.printInfo(); Uncomment the above code and run this Java project. If students put appropriate keywords and visibility modifiers in the Exercise 4-a correctly, you MUST NOT be able to run this code line in this Exercise 5-b-1. Do you know the reason why? * Explain your TA to get the point on this problem, and Explain your answer Exercise 5-a-1 in a comment of the Google Classroom as shown at below figure: X STUDENT NAME Tusedih (Sed history Explain your reason in a comment of Google Classroom Sales-10 Lans to Compressed Archive Esercises. The reason why this code unable to runis Exercise 5-b-2 1/account2.withdraw( 300.00); Uncomment the above code and run this Java project. If students put appropriate keywords and visibility modifiers in the Exercise 4-a correctly, you MUST NOT be able to run this code line in this Exercise 5-6-2. Do you know the reason why? Explain your TA to get the point on this problem, and * Explain your answer Exercise 5-b-2 in a comment of the Google Classroom as shown at below figure: STUDENT NAME Turned in Geory Explain your reason in a comment of Google Classroom E Student LARS Compressed Archive Exercise 5 a The reason why this code unable to us Exercise 5-b-3 W/System.out.println("The balance of account1 is $" + account2. balance); Keep the comment in //account2.withdraw(300.00) and apply the Encapsulation concept to solve the problem in Exercise 5-b-3 and print out the balance of account2. Your running output should be as below: The balance of account is $1000000.0 Do you know the reason why? F Explain your TA to get the point on this problem, and * Explain your answer Exercise 5-b-3 in a comment of the Google Classroom as shown at below figure: STUDENT_NAME Tuned in fery Explain your reason in a comment of Google Classroom E SI LAN Wink Compre Archive Exercio Theredson why he code unable to > F. A Family Member.java BankAccount2_Testing.java BankAccount.java X BankAccount1_Testing.java Users > pauruetai > Downloads > BankAccount.java > P BankAccount >o withdraw(double) 1 package Developer; 2 3 public class BankAccount { 4. //Exercise 4: add properties 5 ?? String ownerName; 6 ?? account Number; 7 ?? double balance; 8 ?? int numAccount = 0; 9 10 ?? BankAccount(String ownerName, String accountNumber, double balance) { 11 this.ownerName = ownerName; 12 this.accountNumber = accountNumber; 13 this.balance = balance; 14 numAccount++; 15 } 16 17 ?? void deposit(double amount) { 18 balance = balance + amount; 19 System.out.println("Deposit: $" + amount); 20 } 21 22 ?? void withdraw(double amount) { 23 if (balance > amount) { 24 balance = balance - amount; 25 System.out.println("Withdraw: $" + amount); 26 } else { 27 System.out.println("Not enough balance!"); 28 } 29 } 30 31 ??void printInfo() { 32 System.out.println(ownerName + "\t" + accountNumber + "\t" + balance); 33 } 34 35 // Exercise 4-b-2: access the encapsulated variables 36 ?? 37 38 } 39 40 41 42 BankAccount1_Testing.java X Fa O Family Member.java BankAccount2_Testing.java BankAccount.java Users > pauruetai > Downloads > BankAccount1_Testing.java > {} Developer 1 ackage Developer; W NP public class BankAccount1_Testing { Run Debug public static void main(String[] args) { 4 BankAccount account1 = new BankAccount("Paris Hilton", "1279833847", 1000000.00); // System.out.println("The balance of account1 is $" + account1.balance); 10 // deposit $300 for accounti // print out the The balance of accounti A 11 12 13 } } 14 Family Member.java BankAccount2_Testing.java x BankAccount.java BankAccount1_Testing.java J Fa o ge Users > pauruetai > Downloads > BankAccount2_Testing.java > {} Outside 1 ackage Outside; 2 3 import Developer.BankAccount; 4 5 public class BankAccount2_Testing { Run Debug public static void main(String[] args) { 7 BankAccount account2 = new BankAccount("Paris Hilton", "127-9833847" 1000000.00); 10 11 // account2.printInfo(); // account2.withdraw(300.00); // System.out.println("The balance of account1 is $" + account2. balance); A 12 } } 13 14