In this homework, we will use Object‐Oriented Programming and write a simple Java program that consists of multiple classes (files) interacting with each other. Your whole program should contain two java files: Hw8.java, Account.java. Suppose you are helping a local branch of an asset management firm to develop a program to track its customers and their accounts. Your program should make it easy to create an account and display account information. Please do the following: Part 1: Account class Create a class called Account and save it in Account.java. The class has the following (private) instance variables: An integer variable for account number; A double variable for account balance; The class has the following (public) instance methods: Constructor Method 1, with no argument: o Simply set account number to 1001, and set account balance to 0; Constructor Method 2, with two arguments: one for account number; one for account balance o Set the account number and the account balance as equal to the argument inputs; A method to set the account number; A method to set the account balance; A method to retrieve the account number; A method to retrieve the account balance; A method to print account information: o Print account number and account balance in one line, in a properly aligned format. Part 2: Program Entry Point: Main Method Create a class called Hw8 that only contains the main method as the entry point of your whole Java program. Save the class in Hw8.java. In your main method, do the following: Create 3 Account objects as follows: o Use Constructor Method 2 to create an Account object: Account Number 1001, Balance 1000.0 o Use Constructor Method 2 to create an Account object: Account Number 1002, Balance 50000.0 o Use Constructor Method 1 to create an Account object. Then call the appropriate methods to set the account number to 1003 and the balance to 3000.0 Let each Account object display its own account information. Think: How to use an array to do the same task? Your program should have the following output: PHOTO ATTACHED Note: Save the two .java files under the same folder If you compile in the command‐line console, you only need to compile Hw8.java, which will automatically triggers the compilation of Account.java. Run your program by entering java Hw8
In this homework, we will use Object‐Oriented Programming and write a simple Java program that consists of multiple classes (files) interacting with each other. Your whole program should contain two java files: Hw8.java, Account.java. Suppose you are helping a local branch of an asset management firm to develop a program to track its customers and their accounts. Your program should make it easy to create an account and display account information. Please do the following: Part 1: Account class Create a class called Account and save it in Account.java. The class has the following (private) instance variables: An integer variable for account number; A double variable for account balance; The class has the following (public) instance methods: Constructor Method 1, with no argument: o Simply set account number to 1001, and set account balance to 0; Constructor Method 2, with two arguments: one for account number; one for account balance o Set the account number and the account balance as equal to the argument inputs; A method to set the account number; A method to set the account balance; A method to retrieve the account number; A method to retrieve the account balance; A method to print account information: o Print account number and account balance in one line, in a properly aligned format. Part 2: Program Entry Point: Main Method Create a class called Hw8 that only contains the main method as the entry point of your whole Java program. Save the class in Hw8.java. In your main method, do the following: Create 3 Account objects as follows: o Use Constructor Method 2 to create an Account object: Account Number 1001, Balance 1000.0 o Use Constructor Method 2 to create an Account object: Account Number 1002, Balance 50000.0 o Use Constructor Method 1 to create an Account object. Then call the appropriate methods to set the account number to 1003 and the balance to 3000.0 Let each Account object display its own account information. Think: How to use an array to do the same task? Your program should have the following output: PHOTO ATTACHED Note: Save the two .java files under the same folder If you compile in the command‐line console, you only need to compile Hw8.java, which will automatically triggers the compilation of Account.java. Run your program by entering java Hw8
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
Related questions
Question
100%
In this homework, we will use Object‐Oriented Programming and write a simple Java program that
consists of multiple classes (files) interacting with each other. Your whole program should contain two
java files: Hw8.java, Account.java.
Suppose you are helping a local branch of an asset management firm to develop a program to track its
customers and their accounts. Your program should make it easy to create an account and display
account information.
Please do the following:
Part 1: Account class
Create a class called Account and save it in Account.java.
The class has the following (private) instance variables:
An integer variable for account number;
A double variable for account balance;
The class has the following (public) instance methods:
Constructor Method 1, with no argument:
o Simply set account number to 1001, and set account balance to 0;
Constructor Method 2, with two arguments: one for account number; one for account balance
o Set the account number and the account balance as equal to the argument inputs;
A method to set the account number;
A method to set the account balance;
A method to retrieve the account number;
A method to retrieve the account balance;
A method to print account information:
o Print account number and account balance in one line, in a properly aligned format.
Part 2: Program Entry Point: Main Method
Create a class called Hw8 that only contains the main method as the entry point of your whole Java
program. Save the class in Hw8.java.
In your main method, do the following:
Create 3 Account objects as follows:
o Use Constructor Method 2 to create an Account object: Account Number 1001, Balance
1000.0
o Use Constructor Method 2 to create an Account object: Account Number 1002, Balance
50000.0
o Use Constructor Method 1 to create an Account object. Then call the appropriate
methods to set the account number to 1003 and the balance to 3000.0
Let each Account object display its own account information.
Think: How to use an array to do the same task?
Your program should have the following output: PHOTO ATTACHED
Note:
Save the two .java files under the same folder
If you compile in the command‐line console, you only need to compile Hw8.java, which will
automatically triggers the compilation of Account.java.
Run your program by entering java Hw8
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
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
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education