Programming Steps Step 1: Write a Java program to define a class called Project4_BankAccount. Let's assume that • the constant lowBalance is used as a threshold to check if the bank account has been overdrawn o set it to 100 (dollars) • • • the instance variables of this class are o balance: if it is below lowBalance, the bank account has been overdrawn o userName the get methods are to get the current value of the instance variables the set methods are to set a new value to the instance variables the operations to change the balance are deposit and withdraw (to set a different balance) the method display Message() will display the current balance and will also display the urgent message of overdrawn if the current balance is below lowBalance. The members of the class Project4_BankAccount are listed in Table 1 on the following page. The sign - is followed by a private member, '+' is followed by a public member. Step 2: Write a Java application called Project4_BankAccount Demo_YourInitial to use class Project4_BankAccount by 1. creating an object of class Project4_BankAccount named theAcct with no initial balance

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Can you please help me with this Java program?
Project 4 Define & Use Class BankAccount
Due on Sunday, 3/5/2023, by 11:59pm
Lab Objectives
This lab was designed to reinforce programming concepts from Chapter 3 of Java How to Program: 11/e.
In this lab you will practice:
• Declaring a class
• Using class objects
Problem Description
Write a Java program to define a class called Project4_BankAccount. Then write a Java application
called Project4_BankAccount Demo_YourInitial to use class Project4_BankAccount.
Programming Steps
Step 1:
Write a Java program to define a class called Project4_BankAccount. Let's assume that
• the constant lowBalance is used as a threshold to check if the bank account has been
overdrawn
o set it to 100 (dollars)
the instance variables of this class are
O balance: if it is below lowBalance, the bank account has been overdrawn
o userName
the get methods are to get the current value of the instance variables
the set methods are to set a new value to the instance variables
the operations to change the balance are deposit and withdraw (to set a different balance)
• the method displayMessage() will display the current balance and will also display the urgent
message of overdrawn if the current balance is below lowBalance.
The members of the class Project4_BankAccount are listed in Table 1 on the following page. The sign '-'
is followed by a private member, '+' is followed by a public member.
Step 2:
Write a Java application called Project4_BankAccount Demo_YourInitial to use class
Project4_BankAccount by
1. creating an object of class Project4_BankAccount named theAcct with no initial balance
Transcribed Image Text:Project 4 Define & Use Class BankAccount Due on Sunday, 3/5/2023, by 11:59pm Lab Objectives This lab was designed to reinforce programming concepts from Chapter 3 of Java How to Program: 11/e. In this lab you will practice: • Declaring a class • Using class objects Problem Description Write a Java program to define a class called Project4_BankAccount. Then write a Java application called Project4_BankAccount Demo_YourInitial to use class Project4_BankAccount. Programming Steps Step 1: Write a Java program to define a class called Project4_BankAccount. Let's assume that • the constant lowBalance is used as a threshold to check if the bank account has been overdrawn o set it to 100 (dollars) the instance variables of this class are O balance: if it is below lowBalance, the bank account has been overdrawn o userName the get methods are to get the current value of the instance variables the set methods are to set a new value to the instance variables the operations to change the balance are deposit and withdraw (to set a different balance) • the method displayMessage() will display the current balance and will also display the urgent message of overdrawn if the current balance is below lowBalance. The members of the class Project4_BankAccount are listed in Table 1 on the following page. The sign '-' is followed by a private member, '+' is followed by a public member. Step 2: Write a Java application called Project4_BankAccount Demo_YourInitial to use class Project4_BankAccount by 1. creating an object of class Project4_BankAccount named theAcct with no initial balance
a. you should choose a proper constructor
2. for this object of the Acct
a.
setting an initial value (for example, $500) to the instance variable balance of this object
i. use the set method
b. calling a proper method of class Project4_BankAccount to display a message about the
balance in the account
c calling a proper method of class Project4_BankAccount to withdraw $300 from the
bank account
d. calling a proper method of class Project4 BankAccount to display a message about the
balance in the account again
request the initial balance from user
3.
4. create another object of class Project4_BankAccount named myAcct with the initial balance
obtained from user in step 3
5. for this object of myAcct, repeat step 2b through 2d, except it is to deposit $200 to the bank
account in step 2c
Step 3:
Run the application Project4 BankAccountDemo YourInitial.java. Snapshot your compiler window to
fully show your output pane and name the image as Project4_BankAccount YourName.png.
You must make sure your both program files are in the same folder.
CS140, TSU
Table 1: Members of class Project4 BankAccount
Project4 BankAccount
- lowBalance: static final double
-balance: double
-username: String
+ Project4_BankAccount (usemame: String):
+ Project4_BankAccount (usemame: String, balance:double):
+getBalance 0:double
+ setBalance (balance: double): void
+ deposit (amount : double): void
+withdraw (amount: double):void
+displayMessage():void
Sample Output
Create an object with no initial balance!
Set $500 to the balance!
Here is account balance information for Li Ma
The current balance in 500.00.
Withdraw $300 from account!
Here is account balance information for Li Ma
The current balance in 200.00.
Please enter the user name Ma
Please enter the initial balance: (392
Create an object with an initial balance!
Here is account balance information for (Ma Lib
www
The current balance in 392.00.
Deposit $200 to account!
Here is account balance information for Ma Li
The current balance in 592.00.
Created by Li Ma
Bank username, initialized
when creating the first
object of the class
Bank usemame and initial
balance, entered by user
Different Bank username,
initialized when creating the
second object of the class
Transcribed Image Text:a. you should choose a proper constructor 2. for this object of the Acct a. setting an initial value (for example, $500) to the instance variable balance of this object i. use the set method b. calling a proper method of class Project4_BankAccount to display a message about the balance in the account c calling a proper method of class Project4_BankAccount to withdraw $300 from the bank account d. calling a proper method of class Project4 BankAccount to display a message about the balance in the account again request the initial balance from user 3. 4. create another object of class Project4_BankAccount named myAcct with the initial balance obtained from user in step 3 5. for this object of myAcct, repeat step 2b through 2d, except it is to deposit $200 to the bank account in step 2c Step 3: Run the application Project4 BankAccountDemo YourInitial.java. Snapshot your compiler window to fully show your output pane and name the image as Project4_BankAccount YourName.png. You must make sure your both program files are in the same folder. CS140, TSU Table 1: Members of class Project4 BankAccount Project4 BankAccount - lowBalance: static final double -balance: double -username: String + Project4_BankAccount (usemame: String): + Project4_BankAccount (usemame: String, balance:double): +getBalance 0:double + setBalance (balance: double): void + deposit (amount : double): void +withdraw (amount: double):void +displayMessage():void Sample Output Create an object with no initial balance! Set $500 to the balance! Here is account balance information for Li Ma The current balance in 500.00. Withdraw $300 from account! Here is account balance information for Li Ma The current balance in 200.00. Please enter the user name Ma Please enter the initial balance: (392 Create an object with an initial balance! Here is account balance information for (Ma Lib www The current balance in 392.00. Deposit $200 to account! Here is account balance information for Ma Li The current balance in 592.00. Created by Li Ma Bank username, initialized when creating the first object of the class Bank usemame and initial balance, entered by user Different Bank username, initialized when creating the second object of the class
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education