Create a class named BankAccount with data fields for a count number and a balance. Include a constructor that takes arguments for each field. The constructor sets the balance to 0 if it is below the required $200.00 minimum for an account. Include a method that displays the account details, including an explanation if the balance was reduced to 0.
Write the class TestAccount in which you instantiate two BankAccount objects, prompt a user for values of the account number and the balance, and then display the values for each field in each account object. Make sure to format the balance output as currency, with the “$" sign and values of dollars and cents (use Java currency formatter). Save both classes as BankAccount.java and TestAccount.java.
Compile, run and test the application. Submit two original .java files as an attachment to your initial response. (Please do not copy/paste the whole file codes into your response.) Zip them into a single .zip file and attach the .zip file to your post. In the initial response itself, provide comments and explanations of your solution, including the UML diagram of your application.
//BankAccount.java
import java.text.NumberFormat;
import java.util.Locale;
public class BankAccount
{
int accountNumber;
double balance;
public BankAccount(int accountNumber, double balance)
{
this.accountNumber = accountNumber;
if(balance < 200)
this.balance = 0;
else
this.balance = balance;
}
public void display()
{
System.out.println("Account number: " + this.accountNumber);
NumberFormat us = NumberFormat.getCurrencyInstance(Locale.US);
if(this.balance == 0)
System.out.println("Your balance was reduced to 0 as balance was below required minimum $200.00");
System.out.println("Balance: " + us.format(this.balance));
}
}
//TestAccount.java
import java.util.Scanner;
public class TestAccount
{
public static void main(String[] args)
{
int accountNumber1, accountNumber2;
double balance1, balance2;
Scanner scanner = new Scanner(System.in);
System.out.print("Enter account number for first account: ");
accountNumber1 = scanner.nextInt();
System.out.print("Enter balance for first account: ");
balance1 = scanner.nextDouble();
System.out.print("Enter account number for second account: ");
accountNumber2 = scanner.nextInt();
System.out.print("Enter balance for second account: ");
balance2 = scanner.nextDouble();
scanner.close();
BankAccount a = new BankAccount(accountNumber1, balance1);
BankAccount b = new BankAccount(accountNumber2, balance2);
a.display();
b.display();
}
}
OUTPUT:

Create a class named BankAccount with data fields for a count number and a balance. Include...
C++ Please create the class named BankAccount with the following properties below: // The BankAccount class sets up a clients account (name & ID), keeps track of a user's available balance. // It also keeps track of how many transactions (deposits and/or withdrawals) are made. public class BankAccount { Private String name private String id; private double balance; private int numTransactions; // Please define method definitions for Accessors and Mutator functions below Private member variables string getName(); // No set...
CIST 2371 Introduction to Java Unit 04 Lab Due Date: ________ Create a folder called Unit04 and put all your source files in this folder. You will create a UML diagram and two Java class files and that implements the classes in the UML diagram. Diagram Create a UML diagram that shows an Account class and an AccountTester class. The Account class holds the following data as Strings: account Number, type of account, card number and expire date. Include getter...
Design a class named BankAccount containing the following data field and methods. • One double data field named balance with default values 0.0 to denote the balance of the account. • A no-arg constructor that creates a default bank account. • A constructor that creates a bank account with the specified balance. throw an IllegalArgumentException when constructing an account with a negative balance • The accessor method for the data field. • A method named deposit(double amount) that deposits...
Now create another class named SavingsAccount. This should be a subclass of BankAccount. A SavingsAccount should have an interest rate that is specified in its constructor. Furthermore, there should be a method, addInterest, that deposits interest into account, based on the account balance and interest rate. Create another subclass of BankAccount named CheckingAccount. A CheckingAccount should keep track of the number of transactions made (deposits and withdrawals). Name this field transactionCount. Also, the set fee for transactions is three dollars,...
Design a class named BankAccount that contains: 1. A private int data field named accountId for the account. 2. A private double data field named accountBalance for the account (default 0). 3. A private double data field named annualInterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. 4. A private Date data field named dateCreated that stores the date when the account was created. 5. A private int data field named numberOfDeposits...
Java Programming assignment. 1. Create a class called Square that takes a width parameter in the constructor. The Square class should have a draw() method that will draw the square on the screen. Create a class called TestSquare that will take width from the user, create an object of Square, and invoke the draw() method on the square object. Below is a UML diagram for the Square and Rectangle class: 3. Create a zip file that contains your Java programs....
Graded Exercise Create a class named Student. A Student has fields for an ID number, number of credit hours earned, and number of points earned. (For example, many schools compute grade point averages based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.) Include methods to assign values to all fields. A Student also has a field for grade point average. Include a method to compute the grade point...
C++ Design a class bankAccount that defines a bank account as an ADT and implements the basic properties of a bank account. The program will be an interactive, menu-driven program. a. Each object of the class bankAccount will hold the following information about an account: account holder’s name account number balance interest rate The data members MUST be private. Create an array of the bankAccount class that can hold up to 20 class objects. b. Include the member functions to...
Design and implement the following 3 classes with the exact fields and methods (these names and caps exactly): 1. An abstract class named BankAccount (java file called BankAccount.java) Description Filed/Method Balance NumberDeposits NumberWithdrawals AnnualInterestRate MonthlyServiceCharge BankAccount SetHonthlyServiceCharges A method that accepts the monthly service charges as an argument and set the field value GetBalance GetNum berDeposits GetNum berWithdrawals GetAnnualinterestRate GetMonthlyServiceCharge A method that returns the monthly service charge Deposit field for the bank account balance A field for the number...
(The Account class) Design a class named Account that contains: A private int data field named id for the account (default 0). A private double data field named balance for the account (default 0). A private double data field named annualInterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default...