Java: Please write in Java 1. Create a checking account class with three attributes: account number, owner’s name, and b

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Java: Please write in Java 1. Create a checking account class with three attributes: account number, owner’s name, and b

Post by answerhappygod »

Java: Please write in Java
1. Create a checking account class with three attributes:account number, owner’s name, and balance.
2. Create constructor, getters and setters. If one is to set theinitial balance of an account as a negative value in a setter or aconstructor, remind the user about the error and set it as 0.
3. Create a CheckingAccountDemo class, and create a main methodin which
a. Ask for the name,account number, and initial balance for one account from thekeyboard input. With these input values as arguments in a call tothe constructor, create a CheckingAccount object.
b. Print the summary ofthis account that includes information on the name, account number,and balance by calling the getters.
Test cases: at least two cases, in one case input positivebalance and in the other case input negative balance
In the CheckingAccount class:a. Create one method for depositing. The deposit method should haveone parameter to indicate the amount to be deposited. You must makesure the amount to be deposited is positive. Otherwise print out anerror message.b. Create one method for withdrawing. The withdraw method shouldhave one parameter to indicate the amount to be withdrawn and useBoolean return type to show the success of the operation. If theamount to be withdrawn is negative or one tries toover-withdraw (i.e the withdrawing amount is more than thebalance), make no change on the balance and return false. If thewithdrawn amount is allowed, update the balance by subtracting thiswithdrawing amount from it and then return true.c. Create a displayAccount() method. i. Print a nicehead that includes the customer’s name (similar to theEmployee class example) ii. Display theaccount number, owner’s name, and current balance, each at aseparate line
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply