subject

5.9.1. groupwork programming challenge : bank account

create a class called bank account below that keeps track of the account holder’s name, the account number, and the balance in the account. make sure you use the appropriate data types for these.

write 2 constructors for the class that initialize the instance variables to default values and to given parameters. for the parameters, use the same variable names as your instance variables. use the this keyword to distinguish between the instance variables and the parameter variables.

write a tostring() method for the class. use the this keyword to return the instance variables.

write a withdraw(amount) and deposit(amount) for the class. withdraw should subtract the amount from the balance as long as there is enough money in the account (the balance is larger than the amount). deposit should add the amount to the balance. use the this keyword to refer to the balance.

test your class below with a main method that creates a bank account object and calls its deposit and withdraw methods and prints out the object to test its tostring() method.

(java btw)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:40
Write a modular program (no classes yet, just from what you learned last year), that allows two players to play a game of tic-tac-toe. use a two-dimensional char array with 3 rows and 3 columns as the game board. each element of the array should be initialized with an asterisk (*). the program should display the initial board configuration and then start a loop that does the following: allow player 1 to select a location on the board for an x by entering a row and column number. then redisplay the board with an x replacing the * in the chosen location. if there is no winner yet and the board is not yet full, allow player 2 to select a location on the board for an o by entering a row and column number. then redisplay the board with an o replacing the * in the chosen location. the loop should continue until a player has won or a tie has occurred, then display a message indicating who won, or reporting that a tie occurred. player 1 wins when there are three xs in a row, a column, or a diagonal on the game board. player 2 wins when there are three ox in a row, a column, or a diagonal on the game board. a tie occurs when all of the locations on the board are full, but there is no winner. input validation: only allow legal moves to be entered. the row must be 1, 2, or 3. the column must be 1, 2 3. the (row, column) position entered must currently be empty (i.e., still have an asterisk in it).
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
The fourth generation of computers emerged between 1970s and 1980s. which technological advancement brought about this generation of computers? which computer architecture was used most in this generation?
Answers: 3
question
Computers and Technology, 24.06.2019 00:20
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
question
Computers and Technology, 24.06.2019 19:50
How to unblock on chrome book? ?
Answers: 1
You know the right answer?
5.9.1. groupwork programming challenge : bank account

create a class called bank account...
Questions
Questions on the website: 13722367