Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, you will be writing three class. One of them is the Student Account class that will be used to represent a student

image text in transcribed
For this assignment, you will be writing three class. One of them is the Student Account class that will be used to represent a student account. The account can be used for deposit, charge, and transfer. The other class is for a special type of Students Account which can receive rewards. This class is the Rewards Account which is a class of Student Account Rewards Account allows an account to receive rewards under certain conditions For Student Account class, you will need to have the variable to represent the account number (acetNo-singlong integer type) and balance (using double type) for cach account. The variables should be private. The account number will be generated automatically based on a counter. For example, the first account created will have the account number 1. and the one created will have the account number. Therefore, you will also need to have a variable to represent the counter and update this counter accordingly. The counter is not for individual objects: instead it will be shared by the entire class. For Rewards Account class, you will also have a double variable rewards) to represent the rewards balance For all the classes, you will need to decide which variables and methods should be static and which ones should be non-static. 1. Student Account class You will need to write the following methods for the Student Account class Constructors All constructors should be defined s ublic A del constructor should be included. The default balance is set to zero and the account number is automatically generated based on the value of the counter . A constructor should be included that receives a single double value as a parameter. The parameter will provide the initial balance for the account Account number will be automatically generated Public Methods getectNe - This is a "get" method used to retrieve the account number get Balance - This is a "get" method used to retrieve the account balance .getCounter - this is a method used to retrieve the number of account created which also serves as the counter for automatically generating the account number set Balance - This is a "set" method used to set the account balance Since the account number and counter should not be modified manually, so there should be no se method for those two variables deposit - This method should receive a double value as a parameter. The parameter indicates how much will be deposited into the account. The amount should be positive (otherwise it doesn't do anything and the program should print a message). The account balance should be updated accordingly charge. This method should receive a double value as parameter. The parameter indicates how much will be charged to the account and the balance should be decreased accordingly. The charge amount should be positive otherwise it doesn't do anything and the program should print a message). The new balance is allowed to be negative transferin - this method allows transferring money from another Student Account. There are two parameters, an object of Student Account and the amount to be transferred in. The amount should be positive otherwise it doesn't do anything. The balance of both accounts should be updated accordingly. The new balance is allowed to be negative transfer Out - this method allows a transfer from the current account to another Student Account. There are two part s, an object of the other Student Account and the amount to be transferred out. The amount would be positive otherwise it doesn't do anything. The balance of both accounts should be updated accordingly. The new balance is allowed to be negative printinfe - this method takes no parameter. It displays the account information in the For this assignment, you will be writing three class. One of them is the Student Account class that will be used to represent a student account. The account can be used for deposit, charge, and transfer. The other class is for a special type of Students Account which can receive rewards. This class is the Rewards Account which is a class of Student Account Rewards Account allows an account to receive rewards under certain conditions For Student Account class, you will need to have the variable to represent the account number (acetNo-singlong integer type) and balance (using double type) for cach account. The variables should be private. The account number will be generated automatically based on a counter. For example, the first account created will have the account number 1. and the one created will have the account number. Therefore, you will also need to have a variable to represent the counter and update this counter accordingly. The counter is not for individual objects: instead it will be shared by the entire class. For Rewards Account class, you will also have a double variable rewards) to represent the rewards balance For all the classes, you will need to decide which variables and methods should be static and which ones should be non-static. 1. Student Account class You will need to write the following methods for the Student Account class Constructors All constructors should be defined s ublic A del constructor should be included. The default balance is set to zero and the account number is automatically generated based on the value of the counter . A constructor should be included that receives a single double value as a parameter. The parameter will provide the initial balance for the account Account number will be automatically generated Public Methods getectNe - This is a "get" method used to retrieve the account number get Balance - This is a "get" method used to retrieve the account balance .getCounter - this is a method used to retrieve the number of account created which also serves as the counter for automatically generating the account number set Balance - This is a "set" method used to set the account balance Since the account number and counter should not be modified manually, so there should be no se method for those two variables deposit - This method should receive a double value as a parameter. The parameter indicates how much will be deposited into the account. The amount should be positive (otherwise it doesn't do anything and the program should print a message). The account balance should be updated accordingly charge. This method should receive a double value as parameter. The parameter indicates how much will be charged to the account and the balance should be decreased accordingly. The charge amount should be positive otherwise it doesn't do anything and the program should print a message). The new balance is allowed to be negative transferin - this method allows transferring money from another Student Account. There are two parameters, an object of Student Account and the amount to be transferred in. The amount should be positive otherwise it doesn't do anything. The balance of both accounts should be updated accordingly. The new balance is allowed to be negative transfer Out - this method allows a transfer from the current account to another Student Account. There are two part s, an object of the other Student Account and the amount to be transferred out. The amount would be positive otherwise it doesn't do anything. The balance of both accounts should be updated accordingly. The new balance is allowed to be negative printinfe - this method takes no parameter. It displays the account information in the

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

Students also viewed these Databases questions