Write a java program. Create a class and then create objects using a separate class. Static modifier: The public static void main method in the class BankProgram. Also known as the main class. BankProgram establishes a "uses" dependency class relationship with the Account class accessible to the main class BankProgram. In BankProgram create an object called acct1 which passes values of name, ID, Balance to Account. Create another object called acct2 which passes values of name, ID, Balance to Account. In Account class create private instance variables, also known as an encapsulated variables, which means they are only accessible in the Account class. Create variables String name, int accountNum, double balance. In Account class create a public constructor. Constructor automatically runs when the class is called. With arguments String initName, int initID, double initBalance all to receive data values. Set instance variables to the argument variables. Create a method returning a double value, public double getBalance. getBalance will return variable balance. In the main class we instantiate the objects, meaning create the objects and data values to be passed. Print with line feed object acct1 method getBalance(). Create a second object having different data values, and likewise print with line feed object acct2 method getBalance(). In Account class create a method called deposit which does not return a value, hence void. It should receive a double data type called amount. Write the code to increase the balance by the amount. In Account class create a method called withdraw which does not return a value, hence void. It should receive both a double data type called amount, and a double data type called fee. Write the code to reduce the balance by the amount, also reduce balance by the fee. In the main class, call an object with a method for the first person. Deposit 5000.00. In the main class, call an object with a method for the second person. Withdraw 200.00 and a fee of 3.00. In the Account class, before the class name add statement to import java.text.NumberFormat.
Write a java program. Create a class and then create objects using a separate class. Static modifier: The public static void main method in the class BankProgram. Also known as the main class. BankProgram establishes a "uses" dependency class relationship with the Account class accessible to the main class BankProgram. In BankProgram create an object called acct1 which passes values of name, ID, Balance to Account. Create another object called acct2 which passes values of name, ID, Balance to Account. In Account class create private instance variables, also known as an encapsulated variables, which means they are only accessible in the Account class. Create variables String name, int accountNum, double balance. In Account class create a public constructor. Constructor automatically runs when the class is called. With arguments String initName, int initID, double initBalance all to receive data values. Set instance variables to the argument variables. Create a method returning a double value, public double getBalance. getBalance will return variable balance. In the main class we instantiate the objects, meaning create the objects and data values to be passed. Print with line feed object acct1 method getBalance(). Create a second object having different data values, and likewise print with line feed object acct2 method getBalance(). In Account class create a method called deposit which does not return a value, hence void. It should receive a double data type called amount. Write the code to increase the balance by the amount. In Account class create a method called withdraw which does not return a value, hence void. It should receive both a double data type called amount, and a double data type called fee. Write the code to reduce the balance by the amount, also reduce balance by the fee. In the main class, call an object with a method for the first person. Deposit 5000.00. In the main class, call an object with a method for the second person. Withdraw 200.00 and a fee of 3.00. In the Account class, before the class name add statement to import java.text.NumberFormat.
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
Write a Java Program
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 4 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