Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a java file with name Checking2, underscore, and your netID. For example, if your netID is batman1, your file name should be Checking2_batman1. The

  1. Make a java file with name Checking2, underscore, and your netID. For example, if your netID is batman1, your file name should be Checking2_batman1. The objective of this assignment is to create a simple class for checking account. Notice that you can recycle some of the code you wrote for last assignment.
  2. Make a class, with same name as your file name (keep in mine the main class name should be consistent with your file name).
    1. There are two data members:
      1. An int variable AccNum.
      2. A float variable Balance.Initialize the value of Balance as 100.
    2. There are three methods:
      1. Deposit. This method will deposit money into your account. This method should have one float parameter. There is no return value for this method. This method adds the value of parameter on the Balance of your current account.
      2. Withdraw. This method will withdraw money from your account. It takes one float parameter. There is an int return value. This method will subtract the value of parameter from the Balance of your current account. If parameter value is larger than balance (you want to withdraw more money than you have), this method will return zero, and keep Balance to be the same as before calling this method. Otherwise, this method will return one.
      3. Main method.The entry point to the program, i.e., public static void main(String[] args)
    3. In the main methods:
      1. Request input from user (you need to request two data: whether user want to deposit or withdraw; and amount).
      2. If user entered "deposit", call Deposit method. Then print "deposit successful". Then print balance amount
      3. If user entered "withdraw", call Withdraw method.

iii. If Withdraw method returns zero, print "your withdraw exceeds limit". Then print balance amount. Otherwise print "withdraw successful" and print balance amount.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Digital Systems Design Using Verilog

Authors: Charles Roth, Lizy K. John, Byeong Kil Lee

1st edition

1285051076, 978-1285051079

More Books

Students also viewed these Programming questions

Question

4. In Exercise 3, are the random variables X and Y independent?

Answered: 1 week ago