Question
how do i fix the errors?
1) Write an Account class that models a bank account with the following data and operations. Data - The identity number for t
balance = 0.0 o ve initiat Balance e Accountint atoentHy aoubve initia balan c e =initial Balance; publie int get Identity N
cloSS CnecvinoA ccount exrends Account return c CheckinaAcont(nt aTotentit aocoe intra 2l2 newBatancersuper etcurrenBoloncecy
0 0
Add a comment Improve this question Transcribed image text
Answer #1


class Account{
   private int identity;
   private double balance;
   public Account() {
       identity = 0;
       balance = 0.0;
   }
   public Account(int aidentity, double initialbalance) {
       identity = aidentity;
       balance = initialbalance;
   }
   public int getIdentityNumber() {
       return identity;
   }
   public double getCurrentBalance() {
       return balance;
   }
   public void setBalance(double someAmount) {
       balance = someAmount;
   }
   public void deposit(double someDeposit){
       balance=balance+someDeposit;
   }
   public void withdraw(double someWithdraw){
       balance=balance-someWithdraw;
   }
}
class CheckingAccount extends Account{
   private double checkCost;
   private double checkAmount;
   public CheckingAccount() {
       super();
       checkCost = 0.0;
       checkAmount = 0.0;
   }
   public CheckingAccount(int aidentity,double inititalBalance,double checkCharge) {
       super(aidentity,inititalBalance);
       checkCost = checkCharge;
   }
   public void createCheck(double amount){
       checkAmount = amount;
   }
   public double clearCharge(){
       double newBalance;
       newBalance = super.getCurrentBalance()-(checkAmount+checkCost);
       if(newBalance<0){
           newBalance = ((checkAmount+checkCost)+newBalance)-25;
           System.out.println("the funds are insufficient");
       }
       return newBalance;
   }
  
  
}
public class BankAccountProgramme {
   public static void main(String[] args) {
       CheckingAccount checkAccount = new CheckingAccount(123,300,150);
       checkAccount.createCheck(250);
       double finalBalance = checkAccount.clearCharge();
       System.out.println(finalBalance);
   }
}

public class BankAccountProgramme t e public static void main (String] args) t CheckingAccount checkAccount = new CheckingAcc

public class BankAccountProgramme ublic static void main(String[] args) CheckingAccount checkAccount = new CheckingAccount (1

public class BankAccountProgramme t e public static void main (String] args) t CheckingAccount checkAccount = new CheckingAccount (123, 1000, 100); checkAccount.createCheck (200) double finalBalancecheckAccount.clearCharge) System.out.println (finalBalance) ft Problems @Javadoc Declaration Console X BankAccountProgramme [Java Application] C:Program Files Javaljre1.8.0_191\binjavaw.exe (Mar 25, 2019 7:08:03 A 700.0

public class BankAccountProgramme ublic static void main(String[] args) CheckingAccount checkAccount = new CheckingAccount (123,300,150); checkAccount.createCheck (250) double finalBalance checkAccount.clearCharge System.out.println (finalBalance) Problems@ Javadoc Declaration Console 3 terminated> BankAccountProgramme [Java Application] CProgram FilesJavaljre1.8.0 191binjavaw.exe (Mar 25, 20197 the funds are insufficient 275.0

We were unable to transcribe this image

Add a comment
Know the answer?
Add Answer to:
how do i fix the errors? 1) Write an Account class that models a bank account...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 14 b. Every bank offers a checking account. Derive the class checkingAccount from the class bankAccount...

    14 b. Every bank offers a checking account. Derive the class checkingAccount from the class bankAccount (designed in part (a)). This class inherits members to store the account number and the balance from the base class. A customer with a checking account typically receives interest, maintains a minimum balance, and pays service charges if the balance falls below the minimum balance. Add member variables to store this additional information. In addition to the operations inherited from the base class, this...

  • code must be in java. Assignment 5 Purpose In this assignment, you will implement a class...

    code must be in java. Assignment 5 Purpose In this assignment, you will implement a class hierarchy in Java. Instructions The class hierarchy you will implement is shown below account Package Account manager Package SavingAccount CheckingAccount AccountManager The descriptions of each class and the corresponding members are provided below. Please note that the Visibility Modifiers (public, private and protected) are not specified and you must use the most appropriate modifiers Class AccountManager is a test main program. Create it so...

  • The code is attached below has the Account class that was designed to model a bank account.

    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,...

  • Textbook help its not in textbook solutions from the textbook C++ Programming 7th edition Malik,D.S Chapter...

    Textbook help its not in textbook solutions from the textbook C++ Programming 7th edition Malik,D.S Chapter 12 programming exercise 5 Banks offer various types of accounts, such as savings, checking, certificateof deposits, and money market, to attract customers as well as meet their specific needs. Two of the most commonly used accounts are savings andchecking. Each of these accounts has various options. For example, you mayhave a savings account that requires no minimum balance but has a lower interest rate....

  • Bank Accounts Look at the Account class Account.java and write a main method in a different...

    Bank Accounts Look at the Account class Account.java and write a main method in a different class to briefly experiment with some instances of the Account class. • Using the Account class as a base class, write two derived classes called SavingsAccount and CheckingAccount. A SavingsAccount object, in addition to the attributes of an Account object, should have an interest variable and a method which adds interest to the account. A CheckingAccount object, in addition to the attributes of an...

  • c++ help please. Savings accounts: Suppose that the bank offers two types of savings accounts: one...

    c++ help please. Savings accounts: Suppose that the bank offers two types of savings accounts: one that has no minimum balance and a lower interest rate and another that requires a minimum balance but has a higher interest rate (the benefit here being larger growth in this type of account). Checking accounts: Suppose that the bank offers three types of checking accounts: one with a monthly service charge, limited check writing, no minimum balance, and no interest; another with no...

  • the programing language is C++ TIC PEO. Design a generic class to hold the following information...

    the programing language is C++ TIC PEO. Design a generic class to hold the following information about a bank account! Balance Number of deposits this month Number of withdrawals Annual interest rate Monthly service charges The class should have the following member functions: Constructor: Accepts arguments for the balance and annual interest rate. deposit: A virtual function that accepts an argument for the amount of the deposit. The function should add the argument to the account balance. It should also...

  • TASK 1 Create a new class called CheckingAccount that extends BankAccount. It should contain a static...

    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...

  • (C++) How do I develop a polymorphic banking program using an already existing Bank-Account hierarchy? For each account...

    (C++) How do I develop a polymorphic banking program using an already existing Bank-Account hierarchy? For each account in the vector, allow the user to specify an amount of money to withdraw from the Bank-Account using member function debit and an amount of money to deposit into the Bank-Account using member function credit. As you process each Bank-Account, determine its type. If a Bank-Account is a Savings, calculate the amount of interest owed to the Bank-Account using member function calculateInterest,...

  • Design a class named BankAccount containing the following data field and methods. • One double data...

    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...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT