Use the Java codes below (Checking Account and Checking Account Demo), and work on these problems. You have to do both of your java codes based on the two provided Java codes.
CHECKING ACCOUNT JAVA:
public class CheckingAccount {
private int AccNumber;
private String Owner;
private double Balance;
CheckingAccount(int AccNumber, String Owner, double
Balance)
{
if(Balance<0)
{
System.err.println("Error. The Balance can't be
negative");
this.Balance = 0.0;
}
else
this.Balance = Balance;
this.AccNumber = AccNumber;
this.Owner = Owner;
}
// setter functions
void setAccNumber(int AccNumber)
{
this.AccNumber = AccNumber;
}
void setOwner(String Owner)
{
this.Owner = Owner;
}
void setBalance(double Balance)
{
if(Balance<0)
{
System.err.println("Error. The Balance can't be
negative");
this.Balance = 0.0;
}
else
this.Balance = Balance;
}
//getter functions
int getAccNumber()
{
return this.AccNumber;
}
String getOwner()
{
return this.Owner;
}
double getBalance()
{
return this.Balance;
}
}
CHECKING ACCOUNT DEMO.JAVA
import java.util.*;
public class CheckingAccountDemo {
public static void main(String[] args)
{
double balance;
String ownerName;
int accountNumber;
Scanner input = new Scanner(System.in);
System.out.println("Enter the name of owner of account: ");
ownerName = input.nextLine();
System.out.println("Enter the account Number: ");
accountNumber = input.nextInt();
System.out.println("Enter the account balance: ");
balance = input.nextDouble();
CheckingAccount object1 = new
CheckingAccount(accountNumber,ownerName,balance);
//calling getter functions
System.out.println("Name : "+object1.getOwner());
System.out.println("Account number : "+
object1.getAccNumber());
System.out.println("Available balance :
"+object1.getBalance());
}
}
CheckingAccount.java
public class CheckingAccount {
private int AccNumber;
private String Owner;
private double Balance;
CheckingAccount(int AccNumber, String Owner, double Balance)
{
if(Balance<0)
{
System.err.println("Error. The Balance can't be negative");
this.Balance = 0.0;
}
else
this.Balance = Balance;
this.AccNumber = AccNumber;
this.Owner = Owner;
}
// setter functions
void setAccNumber(int AccNumber)
{
this.AccNumber = AccNumber;
}
void setOwner(String Owner)
{
this.Owner = Owner;
}
void setBalance(double Balance)
{
if(Balance<0)
{
System.err.println("Error. The Balance can't be negative");
this.Balance = 0.0;
}
else
this.Balance = Balance;
}
//getter functions
int getAccNumber()
{
return this.AccNumber;
}
String getOwner()
{
return this.Owner;
}
double getBalance()
{
return this.Balance;
}
//method for display account details
void displayAccount(){
System.out.println("Name : "+getOwner());
System.out.println("Account number : "+ getAccNumber());
System.out.println("Available balance : "+getBalance());
}
//method for deposit
void depositAmount(double value){
if(value<0){
System.out.println("Amount should be positive");
}
else{
this.Balance+=value;
}
}
//method for withdraw
boolean withdrawAmount(double value){
if(value<0 || this.Balance<value){
return false;
}
else
{
this.Balance-=value;
return true;
}
}
}
CheckingAmountDemo.java
import java.util.*;
public class CheckingAccountDemo {
public static void main(String[] args){
double balance;
String ownerName;
int accountNumber;
Scanner input = new Scanner(System.in);
System.out.println("Enter the name of owner of account: ");
ownerName = input.nextLine();
System.out.println("Enter the account Number: ");
accountNumber = input.nextInt();
System.out.println("Enter the account balance: ");
balance = input.nextDouble();
CheckingAccount object1 = new
CheckingAccount(accountNumber,ownerName,balance);
//calling displayAccount method
object1.displayAccount();
System.out.println("Enter amount to be Deposit:");
double deposit_amount=input.nextDouble();
//calling deposit account
object1.depositAmount(deposit_amount);
object1.displayAccount();
System.out.println("Enter amount to be Withdraw:");
double withdraw_amount=input.nextDouble();
//calling withdrawAmount method
if(object1.withdrawAmount(withdraw_amount)){
System.out.println("Amount withdrawn successfully");
}
else{
System.out.println("Please check enter amount with current
balance");
}
object1.displayAccount();
}
}
Use the Java codes below (Checking Account and Checking Account Demo), and work on these problems....
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package checkingaccounttest; // Chapter 9 Part II Solution public class CheckingAccountTest { public static void main(String[] args) { CheckingAccount c1 = new CheckingAccount(879101,3000); c1.deposit(350); c1.deposit(220); c1.withdraw(100); c1.deposit(1100); c1.deposit(700); c1.withdraw(350); c1.withdraw(220); c1.withdraw(100); c1.deposit(1100); c1.deposit(700); c1.deposit(1000); System.out.println(c1); System.out.println("After calling computeMonthlyFee()"); c1.computeMonthlyFee(); System.out.println(c1); } } class BankAccount { private int...
*Step1: -Create UML of data type classes: reuse from lab3 for class Account, CheckingAccount and SavingAccount -Read the requirement of each part; write the pseudo-code in a word document by listing the step by step what you suppose to do in main() and then save it with the name as Lab4_pseudoCode_yourLastName *Step2: -start editor eClipse, create the project→project name: FA2019_LAB4PART1_yourLastName(part1) OR FA2019_LAB4PART2_yourLastName (part2) -add data type classes (You can use these classes from lab3) Account_yourLastName.java CheckingAccount_yourLastName.java SavingAccount_yourLastName.java -Add data structure...
TASK 1 Create a new class called CheckingAccount that extends BankAccount. It should contain a static constant FEE that represents the cost of clearing onecheck. Set it equal to 15 cents. Write a constructor that takes a name and an initial amount as parameters. Itshould call the constructor for the superclass. It should initializeaccountNumber to be the current value in accountNumber concatenatedwith -10 (All checking accounts at this bank are identified by the extension -10). There can be only one...
IN JAVAThe code is attached below has the Account class that was designed to model a bank account. An account has the properties account number, balance, annual interest rate, and date created, and methods to deposit and withdraw funds. I need creat program using the 2 java programs.Create two subclasses for checking and savings accounts. A checking account has an overdraft limit, but a savings account cannot be overdrawn.I need to write a test program that creates objects of Account,...
The Checking account is interest free and charges transaction fees. The first two monthly transactions are free. It charges a $3 fee for every extra transaction (deposit, withdrawal). The Gold account gives a fixed interest at 5% while the Regular account gives fixed interest at 6%, less a fixed charge of $10. Whenever a withdrawal from a Regular or a Checking account is attempted and the given value is higher than the account's current balance, only the money currently available...
WHERE in this code should you put the main method so that the code will compile WITHOUT changing anything else in the code? Simply adding the main method only? public class Account { private String name; private double balance; public Account(String name, double balance) { this.name = name; if (balance > 0.0) this.balance = balance; } public void deposit(double depositAmount) { if (depositAmount > 0.0) balance += depositAmount; } public double getBalance() { return balance; } public String...
Hello everybody. Below I have attached a code and we are supposed to add comments explaining what each line of code does. For each method add a precise description of its purpose, input and output. Explain the purpose of each member variable. . Some help would be greaty appreciated. (I have finished the code below with typing as my screen wasnt big enough to fit the whole code image) } public void withdrawal (double amount) { balance -=amount; }...
NETBEANS JAVA BANK PROGRAM (TAKE SCREENSHOTS FROM NETBEANS INCLUDING OUTPUT PLEASE) Display the accounts for the current displayed customer PLEASEEEEEEEEEE package bankexample; import java.util.UUID; public class Customer { private UUID id; private String email; private String password; private String firstName; private String lastName; public Customer(String firstName, String lastName, String email, String password) { this.id = UUID.randomUUID(); this.firstName = firstName; this.lastName = lastName; this.email = email; this.password = password; } public String getFirstName() { return firstName; } public void setFirstName(String...
According to the following information, define Account, CheckingAccount, and TestPart1 classes. 1. Account and CheckingAccount classes Account - number: int - openDate: String - name: String - balance: double + Account(int, String, String, double) + deposit(double): void + withdraw (double): boolean + transferTo(Account, double): int + toString(): String CheckingAccount + CheckingAccount(int, String, String, double) + transferTo(Account, double): int Given the above UML diagam, define Account and CheckingAccount classes as follow: Account (8 points) • public Account(int nu, String op, String...