English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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

2 answers

That code is incomplete: it doesn't have a closing curly bracket for the while loop. Too long a posting?

2007-01-16 16:04:05 · answer #1 · answered by Anonymous · 0 0

LOL. That SURE looks like a programming CLASS question or assignment. Why don't you figure it out yourself? I haven't coded in awhile and even I could do that!

2007-01-16 16:03:20 · answer #2 · answered by twobearcatz 1 · 0 1

fedest.com, questions and answers