Please help change this code to a complete the same tasks but using a do loop
static void Main()
{
string userin;
char selection=' ';
double beginBalance;
double newBalance;
int numChecks=0;
double checkAmount=0;
double depositAmount=0;
int numDeposits=0;
Console.Write("Please enter the beginning check-book balance: ");
userin = Console.ReadLine();
beginBalance = Convert.ToDouble(userin);
newBalance = beginBalance;
while ((selection != 'q' || selection != 'Q')&& newBalance >0)
{
Console.WriteLine("Please enter the type of transaction you would like to make?");
Console.WriteLine("Please enter the type of transaction you would like to make?");
Console.WriteLine("Transaction codes you must enter are as follows:");
Console.WriteLine("D or d Deposit");
Console.WriteLine("C or c Check");
Console.WriteLine("When you have completed entering the transactions please enter Q or q to quit");
userin = Console.ReadLine();
selection = Convert.ToChar(userin);
2007-01-16
15:58:54
·
2 answers
·
asked by
Sad Mom
3
in
Computers & Internet
➔ Programming & Design
if (selection == 'c' || selection == 'C')
WriteCheck(ref numChecks,ref checkAmount,ref newBalance);
else if (selection == 'd' || selection == 'D')
MakeDeposit(ref numDeposits, ref depositAmount, ref newBalance);
else if (selection == 'q' || selection == 'Q')
break; if (newBalance < 0 )
Console.WriteLine("Balance is Negative");DisplayChkBook(numChecks,beginBalance,checkAmount, numDeposits, depositAmount, newBalance); }
public static void WriteCheck(ref int numChecks, ref double checkAmount, ref double newBalance{
double check;
Console.WriteLine("Please enter check amount");
check = Convert.ToDouble(Console.ReadLine());
newBalance = (newBalance - check);
checkAmount = checkAmount +
2007-01-16
16:05:33 ·
update #1