Idk what title is appropiate for this lol but someone can help me?
Code:
switch (TransactionType){
case 'w':
EndingBalance = InitialBalance - TransactionAmount;
NumberOfWithdrawals++;
System.out.println("Account Number: " + AccountNum);
System.out.println("Beggining Balance: $" + InitialBalance);
System.out.println("Ending Balance: " + EndingBalance);
System.out.println("Total amount withdrawn: $" + TransactionAmount);
System.out.println("Number of withdrawals: " + NumberOfWithdrawals);
System.out.println("Withdraw again? (1/0): ");
again = in.nextInt();
while (!found)
if (again == 0)
{
System.out.println("Transaction done!");
found = true;
}
else if (again == 1)
{
double finaal;
NumberOfWithdrawals++;
System.out.println("Enter amount to be withdrawn: ");
withdrawn = in.nextDouble();
System.out.println("Account number: " + AccountNum);
finaal = EndingBalance - withdrawn;
System.out.println("Beggining Balance: " + EndingBalance); //What i wanted to happen is to change this into a new variable
//so it'll be the InitialBalance on the next loop(If the user would like to
//withdraw again).
System.out.println("Ending Balance: " + finaal);
System.out.println("Number of Withdrawals: " + NumberOfWithdrawals);
System.out.println("Withdraw again?: (1/0) ");
again = in.nextInt();
found = false;
}
Re: Idk what title is appropiate for this lol but someone can help me?
I would make a method called withdraw() and then have a loop in main() that calls withdraw(). What I see in your code is a repeat of the code that withdraws money. You could possibly accomplish what you want to without making a separate method, but it seems like a good idea. That's what methods are for.
Re: Idk what title is appropiate for this lol but someone can help me?
Stating your perception of what the problem is that you are asking for help with may go a long way towards also finding an appropriate title for the post.....
Additionally, one might be so inclined to provide code more in-line with an sscce it would be significantly easier for others to determine the actual problem and/or solution.
One thing I can recommend, isolate out all of the code for the withdrawal menu, and isolate the actual code for conducting the withdrawal, turn these into separate methods, allowing for easier re-use.
Re: Idk what title is appropiate for this lol but someone can help me?
Re: Idk what title is appropiate for this lol but someone can help me?
Re: Idk what title is appropiate for this lol but someone can help me?
Quote:
Originally Posted by
DarrylBurke
I think that the appropriate title for this thread is "let's see how I can waste all of your time".