Use random function to create account number

Assignment Help JAVA Programming
Reference no: EM13312347

BANK ACCOUNT

Part A:

Create file Account.java. File Account.java contains a class representing a bank account similar (Note that the constructor generates the account number randomly.) Save this file to your directory and use it in Part B. Class Account allows deposit, withdraw, and inquire. This class contains:

• Constructor: initialize account information (ex. A/C name and A/C number) and account balance.
• Withdraw method: deducts amount from current balance.
• Deposit method: adds amount to current balance.
• Inquiry method: returns current balance.
• ToString method: returns account information in a nice string. Example: Name: "Account Name" Balance: "Account Balance" Account Number: "Account Number."
• Number of Account method: returns the total number of accounts.

Requirement:

a. Use Random function to create account number. Random Function: Math.random().
b. Withdraw method -- Deducting amount from balance, if balance doesn't cover withdrawal, prints message "insufficient funds" and does not change the balance.
c. Suppose the bank wants to keep track of how many accounts exist.

Declare a private static integer variable numAccounts to hold this value. It will automatically be initialized to 0.

o Add code to the constructor to increment this variable every time an account is created.
o Add a static method numAccounts that returns the total number of accounts. (Think about why this method should be static -- its information is not related to any particular account.)

Part B:

Create file AccountTest.java to test Account.java follow on the following requirements:

a. Create a new account from Account.java. The account name is " Mike" and initial balance is 500.
b. Get Account information.
c. Deposit an amount of 500 to Mike account and inquire new balance.
d. Create a new account from Account.java. The account name is " Susan" and initial balance is 100.
e. Withdraw an amount of 50 from Susan account and inquire new balance.
f. Withdraw another amount of 70 from Susan account. (You should get message insufficient funds at this point.)
g. Returns the total number of accounts.

VERY IMPORTANT DOCUMENTATION THAT IS NECCESARY!!!

• Documentation of the project, containing the algorithm, produced in pseudocode or flowchart, as well as the UML diagram representing the class structure of the program.

• Detailed instructions on how to use the program and its intricacies. 

Reference no: EM13312347

Questions Cloud

Determine the forces fx and fy necessary to hold the pipe : Water flows steadily through a horizontal 30 degree upward bend. The inlet diameter is 0.3 m, the velocity is 12 m/s, and the pressure is 128 kpa gage. The outlet diameter is 0.38 m and the pressure is 145 kpa gage.
Explain what is the equilibrium concentration of h3o : Consider the following reaction: HC2H3O2 (aq) + H2O (l) = H3O+ (aq) + C2H3O2- (aq) Kc=1.8*10^-5 If a solution initially contains 0.260M HC2H3O2, what is the equilibrium concentration of H3O+ at 25C
Determine the optimal amount of space rays and zappers : Galaxy Industries is a manufacturing company that produces two toy doll models: the Space Ray and the Zapper. The Space Ray can be sold for a profit of $8/dozen and a profit of $5 can be made if a dozen of Zappers are sold.
Calculate the height to whcih the ball rises above the cliff : A 0.17kg ball is thrown vertically upwards with a velocity of 34m/s at the edge of a 22m cliff. Neglect air resistance. calculate The height to whcih the ball rises above the cliff
Use random function to create account number : Add a static method numAccounts that returns the total number of accounts. (Think about why this method should be static -- its information is not related to any particular account.)
Explain the use extraction or recrystallization : In the purification of a mixture, what determines whether you use extraction or recrystallization as the initial procedure
Determine the external wind pressure acting on the windward : A closed storage building is located on open flat terrain in central ohio. If the side wall of the building is 20ft high, determine the external wind pressure acting on the windward and leeward walls. Each wall is 60ft long.
Create the look for two gui applications : Create the look for two GUI applications. You WILL NOT be getting the applications to do anything. We are only interested in seeing how well you can arrange the GUI components onto the window
How do the two sets of values compare : The graph of two cars that collide shows that they intersect at a point 5.5m on a distance/time graph. The first car has a velocity of 0.39m/s. How do the two sets of values compare

Reviews

Write a Review

JAVA Programming Questions & Answers

  Java program that will prompt the user to input a file

Write a Java program that will prompt the user to input a file (document) in order to count the frequency of each word. This program will display the frequency of each word sorted alphabetically or by frequency (depending on the preference of the use..

  What would be an incorrect way of writing this equation

Jim develops 5 Java applications a year. Joe develops 10 Java applications a year. Jim gets paid $5000.00 per application, but Joe gets paid $10000.00 per application.

  Write down the java code for the bank

Write down the java code for the bank of Fraud. User is presented with menu which looks something like this: 1. Deposit 2. Withdrawal 3. Check Balance 4. Exit.

  Design an object-oriented java application

You are to design an object-oriented Java application to let the user play a dice game that uses two dices. The player bets on a value and the dices roll

  Write java program to read in sequence of hourly temperature

Write down Java program which reads in sequence of hourly temperature readings over 24-hour period using arrays. Your program must find and show maximum and minimum temperatures.

  Construct the student class student.h

Construct the Student Class Student.h and Student.cpp student class should include a Student.h header file for your class definitions and a Student.cpp implementation file comprised of first name, last name, ram id

  Java program to decide whether integer is perfect number

For example, 6 is a perfect number because 6 = 1 + 2 + 3. Write a Java program that decides whether integer is a perfect number.

  Modify each sorting algorithm

Modify each sorting algorithm so that it keeps track of the number of comparisons it performs and the number of exchanges (swaps) it performs during a single sorting operation. Keep track of these numbers using two long integer counters

  Give an example of an exception

A. Give an example of an exception that could be generated outside your code but caught within your code

  A program that reads a four-digit number from the keyb

Write a program that reads a four-digit number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, the output should be 12. Hint: Break the string into characters and then convert each character to a va..

  Method that accepts a string object

Word Counter Write a method that accepts a String object as an argument and returns the number of words it contains. For instance, if the argument is "Four score and seven years ago" the method should return the number

  Write a java program to register students for a college

Project is for designing and developing a College Registration program. Write a Java program to register students for a college

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd