i have just wrote all this now I have to use a do while statement loop and so sleepy its due in the morning. Could someone help me figure out a fast way to enter it as a do while?
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("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();
2007-01-16
16:35:46
·
1 answers
·
asked by
Sad Mom
3
in
Computers & Internet
➔ Programming & Design
selection = Convert.ToChar(userin);
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 + check;
++numChecks; } public static void MakeDeposit(ref int numDeposits, ref double depositAmount, ref double newBalance)
{double deposit;
Console.WriteLine("Please enter deposit amount");deposit = Convert.ToDouble(Console.ReadLine();
2007-01-16
16:41:04 ·
update #1