A private int data field named accountNum for the account (default 0). A private string data field named accountName for the account (default "none"). A private double data field named balance for the account (default 0). A private int data field named numTransactions that will count the number of deposit and withdraw transactions made to an account. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default account. A constructor that creates an account with the specified account number and name. The accessor and mutator methods for account number, name. The accessor method for balance and dateCreated. A method named withdraw that withdraws a specified amount from the account. A method named deposit that deposits a specified amount to the account. A method named displayAccountInfo that displays all the information in the Account object. A method named combine that takes another Account object as an argument and adds up balances and number of transactions to current Account object. package assignment2; public class Test { public static void main(String[] args) { Account account = new Account(1122, "my checking account"); account.deposit(3000); account.withdraw(2500); account.deposit(800); account.withdraw(200); account.displayAccountInfo(); if (account.getBalance() != 1100) { System.out.println("Something went wrong! " + account.getAccountName() + " should have 1100 CAD balance."); } System.out.println(); Account accountSavings = new Account(1133, "my savings account"); accountSavings.deposit(10000); accountSavings.deposit(2000); accountSavings.displayAccountInfo(); System.out.println(); account.combine(accountSavings); account.setAccountNum(1190); account.setAccountName("my all money at the bank"); account.displayAccountInfo(); } } "Test.java" and below output is expected: Account num: 1122Account name: my checking accountBalance: 1100.0 CAD4 transactions since created at Thu Jul 06 12:55:20 PDT 2023Account num: 1133Account name: my savings accountBalance: 12000.0 CAD2 transactions since created at Thu Jul 06 12:55:21 PDT 2023Account num: 1190Account name: my all money at the bankBalance: 13100.0 CAD6 transactions since created at Thu Jul 06 12:55:20 PDT 2023 USE PDT time, makes sure the code is right
A private int data field named accountNum for the account (default 0). A private string data field named accountName for the account (default "none"). A private double data field named balance for the account (default 0). A private int data field named numTransactions that will count the number of deposit and withdraw transactions made to an account. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default account. A constructor that creates an account with the specified account number and name. The accessor and mutator methods for account number, name. The accessor method for balance and dateCreated. A method named withdraw that withdraws a specified amount from the account. A method named deposit that deposits a specified amount to the account. A method named displayAccountInfo that displays all the information in the Account object. A method named combine that takes another Account object as an argument and adds up balances and number of transactions to current Account object. package assignment2; public class Test { public static void main(String[] args) { Account account = new Account(1122, "my checking account"); account.deposit(3000); account.withdraw(2500); account.deposit(800); account.withdraw(200); account.displayAccountInfo(); if (account.getBalance() != 1100) { System.out.println("Something went wrong! " + account.getAccountName() + " should have 1100 CAD balance."); } System.out.println(); Account accountSavings = new Account(1133, "my savings account"); accountSavings.deposit(10000); accountSavings.deposit(2000); accountSavings.displayAccountInfo(); System.out.println(); account.combine(accountSavings); account.setAccountNum(1190); account.setAccountName("my all money at the bank"); account.displayAccountInfo(); } } "Test.java" and below output is expected: Account num: 1122Account name: my checking accountBalance: 1100.0 CAD4 transactions since created at Thu Jul 06 12:55:20 PDT 2023Account num: 1133Account name: my savings accountBalance: 12000.0 CAD2 transactions since created at Thu Jul 06 12:55:21 PDT 2023Account num: 1190Account name: my all money at the bankBalance: 13100.0 CAD6 transactions since created at Thu Jul 06 12:55:20 PDT 2023 USE PDT time, makes sure the code is right
Chapter14: Files And Streams
Section: Chapter Questions
Problem 4E
Related questions
Question
- A private int data field named accountNum for the account (default 0).
- A private string data field named accountName for the account (default "none").
- A private double data field named balance for the account (default 0).
- A private int data field named numTransactions that will count the number of deposit and withdraw transactions made to an account.
- A private Date data field named dateCreated that stores the date when the account was created.
- A no-arg constructor that creates a default account.
- A constructor that creates an account with the specified account number and name.
- The accessor and mutator methods for account number, name.
- The accessor method for balance and dateCreated.
- A method named withdraw that withdraws a specified amount from the account.
- A method named deposit that deposits a specified amount to the account.
- A method named displayAccountInfo that displays all the information in the Account object.
- A method named combine that takes another Account object as an argument and adds up balances and number of transactions to current Account object.
package assignment2;
public class Test {
public static void main(String[] args) {
Account account = new Account(1122, "my checking account");
account.deposit(3000);
account.withdraw(2500);
account.deposit(800);
account.withdraw(200);
account.displayAccountInfo();
if (account.getBalance() != 1100) {
System.out.println("Something went wrong! " + account.getAccountName() + " should have 1100 CAD balance.");
}
System.out.println();
Account accountSavings = new Account(1133, "my savings account");
accountSavings.deposit(10000);
accountSavings.deposit(2000);
accountSavings.displayAccountInfo();
System.out.println();
account.combine(accountSavings);
account.setAccountNum(1190);
account.setAccountName("my all money at the bank");
account.displayAccountInfo();
}
}
"Test.java" and below output is expected:
Account num: 1122
Account name: my checking account
Balance: 1100.0 CAD
4 transactions since created at Thu Jul 06 12:55:20 PDT 2023
Account num: 1133
Account name: my savings account
Balance: 12000.0 CAD
2 transactions since created at Thu Jul 06 12:55:21 PDT 2023
Account num: 1190
Account name: my all money at the bank
Balance: 13100.0 CAD
6 transactions since created at Thu Jul 06 12:55:20 PDT 2023
Account name: my checking account
Balance: 1100.0 CAD
4 transactions since created at Thu Jul 06 12:55:20 PDT 2023
Account num: 1133
Account name: my savings account
Balance: 12000.0 CAD
2 transactions since created at Thu Jul 06 12:55:21 PDT 2023
Account num: 1190
Account name: my all money at the bank
Balance: 13100.0 CAD
6 transactions since created at Thu Jul 06 12:55:20 PDT 2023
USE PDT time, makes sure the code is right
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
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
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L