Thursday, December 15, 2011

Design a class named BankAccount in java to hold data for bank account?

Design a class named BankAccount in java to hold data for bank a account


-Balance


- Number of deposits this month


- Number of withdrawals


- Annual Interest rate


- Monthly service charges





The class should have the following methods:





Constructor : The constructor should accept aruguments for the balance and annual interest rate.








deposit: A method that accepts an argument for the amount of the deposit.The method should add the argument to the account balanc.


It should also increment the variable holding the number of deposits.








withdraw: A method that accepts an argument for the amount of withdrawal.The method should substract the argument from the balance.


It should also increment the variable holding the number of withdrawals.








calcInterest: A method that updates the balance by calculating the monthly interest earned by the account,and adding this interest earned by the account,


and adding this interest to the balance.This is performed by the following formulas:


Monthly Interest Rate = (Annual Interest Rate/12)


Monthly Interest =Balance * Monthly Interest Rate


Balance = Balance + Monthly Interest








montlyProcess: A method that substracts the montly service charges from the balance,calls the calcInterest method,and then sets the variables that hold


the number of withdrawls,number of deposits,and monthly services to zero.











Next,design a SavingAccount class that extends the BankAccount class.


The SavingsAccount class should have a status field to represent an acctive or inactive account.


If the balance of a savings account falls below $25,it becomes inactive.


(The status field could be a boolean variable.)No more withdrawals may be made until the balance is raised above $25,at which time the account becomes active again.











The savings account class should have the following methods:





withdraw: A method that determines whether the account is inactive before a withdrawal is made.


(No withdrawal will be allowed if the account is not active.)A withdrawal is then made by calling the superclass version of the method.





deposit : A method that deterines whether the account is inactive before a deposit is made.If the account is inactive and the deposit brings the balance abovee $25,the account becomes active agian.


A deposit is then made by calling the superclass version of the method.





monthlyProcess: Before the superclass method is called,this method checks the number of withdrawals.If the number of withdrawals for the month is more than 4,a service charge of $1 for each withdrawal above 4 is added to the superclass field that holds the monthly service charges.


(Don't forget to check the account balance after the service charge is taken.If the balance falls below $25,the account becomes inactive.)|||If you do not know Java, you could start with the Java Tutorial here


http://java.sun.com/docs/books/tutorial/





Scroll down to Getting Started and click on the link.


Check out Learning the Java Language as well.





I will give you some basics, but not do the whole thing myself.





You need to create a class BankAccount





public class BankAccount{


...


}





Inside this class you need to add methods.


The constructor


public BankAccount(double balance, double interestRate) {


...


}


The deposit method


public void deposit(double amount) {


...


}


The withdrawal method


public void withdrawal(double amount) {


...


}


The calcInterest method


private void calcInterest() {


...


}


The monthlyProcess method


protected void monthlyProcess() {


...


}





Now create a SavingsAccount class


public class SavingsAccount extends BankAccount {


...


}


The constructor


public SavingsAccount(double balance, double interestRate) {


super(balance, interestRate);


...


}


The deposit method


public void deposit(double amount) {


...


}


The withdrawal method


public void withdrawal(double amount) {


...


}


The monthlyProcess method


protected void monthlyProcess() {


...


}





You will need some variables in both classes.


BankAccount:


private double balance = 0.0;


private int deposits = 0;


private int withdrawals = 0;


private double interestRate = %26lt;whatever the interest rate is%26gt;;


private double serviceCharge = 1;





SavingsAccount:


private double minBalance = 25;


private boolean active = false;





The Main class


public static void main(String[] args) {


...


}





Variables:


private SavingsAccount sAccount;





In the main method create a new SavingAccount





That is a brief description, and gives you a start on what you will have to learn to be able to understand it.|||HOW many classes are we supposed to write?


I was going to do BankAccount for you (I had most of it written) until I saw that you were asking for even more.





Do your own homework. It only gets harder from here on out.


If you can't get classes, you're ******.

Math question..........?

1. Edna Kropp's gross income for a year included salary, $12,400; commission, $27,750; interest, $440. Her adjustments to income were payments to a retirement plan, $2,000, and a penalty for withdrawing savings early from a time-deposit account, $126.


a. What was her gross income for the year?








b. Find her adjusted gross income for the year.|||Refer to this link to answer your problem: http://www.basic-mathematics.com/adjuste…





I hope this helps!

What happens if you haven't verified your ScotiaCard....?

I've been very busy in the past few months, and a long time ago ScotiaBank sent me a new debit card with a chip in it, and they told me to verify it (the card is verified by depositing/withdrawing money) and they wanted me to verify it within about 90 days of receiving the card (I believe).





That was almost a year ago and I want to get it verified now. Would it still work if I tried a year later? Or do I need to get something specially done?|||Call Scotia Bank and aks them what you would need to do get a new card would be the answer, and have the new card verified.

My Pokemon Diamond Rom freezes up? Help?

Every time I try to use a Pc to withdraw/deposit pokemon, it freezes. Any help would be greatly appreciated.|||did you use cheats? gameshark? etc... that might cause it.|||That's because it is a DS ROM. Those are very unreliable. Using PC and switching pokes causes a great deal of save data change. With the natural instability of DS emulators, I'm not surprised that it crashed.|||Delete the ROM, keep the save file, and download another copy of the ROM, sometimes that happens.|||set up the configuration.

At a pokersite (pretty much all) when they match your first deposit can you just have that money payed out?

it seems too easy to just double your money and be able to withdraw it is there a clause that you have to play that money or leave it in for a certain amount of time|||You don't get the money right away. You have to play for real money and it is released a fraction at a time.





The days of making free money with deposit bonuses are long gone.|||Yes, obviously there is. Depending on the site will depend on the rules. Some give you all the money to play with right away, and you have to play a certain amount... others will take your bonus and put it aside and release it to you in pieces, once you've played enough to earn those pieces.|||Yes, you should play a certain amount of hands in order to be able to withdraw the bonus money. As a rule, poker rooms credit points for every $1 bet in cash games and tournament fees, redeemable for bonus Dollars at the end of the month. You are given a certain period of time to "earn" your bonus points - from 30 to 60 days, as a rule. Although you may see $600 or $800 bonuses, it's hard to "play out" such amount in 30 days if you are a beginner. So, read the rules and calculate your possible bonus besed on your table limits and the number of hours you play per day.

Can the company that I work for take money back out of my personal account?

A coworker of mine has direct deposit for her bi-weekly paycheck into her personal checking account. At some point in time, the company has made some sort of a mistake with the amount and given her too much money on a paycheck and had to get the money back from her. On two occasions, they have gone directly to the account and withdrawn the money from her account without her authorization. Does anyone know if this is legal?|||I dont believe that is legal. Its possible to do because they have all the banking info but i dont think its legal. I would talk to the bank and the company about this. They should ask the bank why they are letting this happen and they should ask the company to simply tell her if they made a mistake. Then she can give the money back. Also she she talk to HR about it. and not whoever is in charge of the payroll. Maybe someone shouldn't have the job that they have if they keep making this mistake. Maybe someone is stealing money....|||It is legal for the company to correct the mistake. Even though on her end, it seems like the company is going into her checking account to withdraw the money, all they did was go into the website where they process payroll and make the corrections. Therefore, the overage will automatically be deducted from her account.

C++ programming, debuging?

I have made the source as below, and if I compile it,


it keeps getting a compile time error that I can not find.


Thank you for your help.








#include %26lt;iostream%26gt;


#include %26lt;string%26gt;





using std::cout;


using std::endl;


using std::cin;





typedef struct account{


char acc_num[20];


char name[20];


char balance[20];


} ACCOUNT;





void make_f( ACCOUNT *array);


void deposit_f(ACCOUNT *array);


void withdraw_f(ACCOUNT *array);


void inquire_f(ACCOUNT *array);





enum { MAKE_ACCOUNT=1, DEPOSIT, WITHDRAW, INQUIRE } ;











int num=0; // NUMBER OF ACCOUNTS


const int MAX =100;








int main()


{


int select;


ACCOUNT array[MAX];





while(1)


{


cout%26lt;%26lt; "Select transaction: \n";


cout%26lt;%26lt;"MAKE_ACCOUNT \n DEPOSIT \n WITHDRAW \n INQUIRE \n";





cin%26gt;%26gt; select;





switch(select)


{


case(1): make_f(array);


break;


case(2):deposit_f(array);


break;


case(3):withdraw_f(array);


break;


case(4):inquire_f(array);


break;


default: cout%26lt;%26lt; "wrong input";


break;





}





return 0;


}








void make_f( ACCOUNT *array)


{


cout%26lt;%26lt; "Input an account number you want to make : ";


cin%26gt;%26gt; array[num]-%26gt;acc_num;


cout%26lt;%26lt; "Input name: ";


cin%26gt;%26gt; array[num]-%26gt;name;





num++;


}











void deposit_f(ACCOUNT *array)


{


int i;


char acc_number[20];


int deposit;





cout%26lt;%26lt; "Input account number";


cin%26gt;%26gt; acc_number;





for(i=0;i%26lt;num;i++)


{


if(strcmp(acc_number,array[i]-%26gt;acc_n鈥?br>

{


break;


}


}





cout%26lt;%26lt; "Input the ammount of money to deposit:";


cin%26gt;%26gt; deposit;


(array[i]-%26gt;balance)+=deposit;


cout%26lt;%26lt;"Current balance is "%26lt;%26lt; array[i]-%26gt;balance%26lt;%26lt;endl;





}








void withdraw_f(ACCOUNT *array)


{


int withdraw;


char acc_number[20];





cout%26lt;%26lt; "Input account number";


cin%26gt;%26gt; acc_number;





for(i=0;i%26lt;num;i++)


{


if(strcmp(acc_number,array[i]-%26gt;acc_n鈥?br>

{





break;


}


}





cout%26lt;%26lt; "Input withdraw ammount: ";


cin%26gt;%26gt; withdraw;





array[i]-%26gt;balance-=withdraw;


cout%26lt;%26lt;"Current balance is "%26lt;%26lt; array[i]-%26gt;balance%26lt;%26lt;endl;


}











void inquire_f(ACCOUNT *array)


{


for(int i=0;i%26lt;num;i++)


{


cout%26lt;%26lt; "name: "%26lt;%26lt; array[i]-%26gt;name %26lt;%26lt; endl;


cout%26lt;%26lt; "account number : "%26lt;%26lt; array[i]-%26gt;acc_num %26lt;%26lt; endl;


cout%26lt;%26lt; "balance: "%26lt;%26lt; array[i]-%26gt;balance %26lt;%26lt; endl;


}


}|||G'day mate,





You are missing the ending brace } for the main function.





return 0;


}


}





This is why the compiler thinks you have internal functions. They are in the main function. The "local function definitions are illegal" errors.





It will also get rid of the "unexpected end of file found" as you have enough end braces }





Hope that helps.|||The code seems fine. One way of catching the problem would using the "exception handling" technique in C++, with some (Exception - Try, Catch, Finally). That would help u to identify the run-time error. and to decide how to handle it..|||Code looks all right.


=


Which compiler are you using?


- Check warning %26amp; optimization settings.