Console.WriteLine(\"----------------------------\"); console.WriteLine(\"CHOOSE
ID: 3811613 • Letter: C
Question
Console.WriteLine("----------------------------"); console.WriteLine("CHOOSE AN OPTION TO CONTINUE:"); Select int.Parse(Console.ReadLine()); if (select ==0)//This part quits the program break; switch (select) {case 1://Opening a new checking account//Get the name and balance from the user Console.Clear(); Console.WriteLine("Enter the customer's name"); checkingname = Console.ReadLine(); Console.WriteLine("Enter the initial amount"); checkingbalance = double.Parse(Console.ReadLine()); Console.WriteLine("A new checking account has been creadted"); Console.WriteLine("Please press any key to return to the main menu"); console.ReadLine(); break; case 2://Opening a new savings account//Get the name, balance, numberofyears and interestrate from the user//Do not forget to update the balance with the interestrate and years entered by the user case 3://Deposit to checking account Console.Clear(); console.WriteLine("Enter the deposit amount"); amount = double.Parse(Console.ReadLine()); checking balance = checkingbalance + amount; Console.WriteLine("{0} has been added to the account", amount); Console.WriteLine ("the balance is {0}", checkingbalance); Console.WriteLine("Please press any key to return to the main menu"); break; case 4://Deposit to savings account case 5://withdraw from checking account case 6://Withdraw from savings account case 7://Balance Inquiry for Checking Account Console.Clear(); Console.WriteLine("{0} has {1} in his account", checkingname, checkingbalance); Console.WriteLine("Please press a key to return to the main menu"); break case 8://Balance Inquiry for Savings Account default: break;}}}}Explanation / Answer
Hi,
Please find the below codes for the required cases statements. Please declare all the variable that are used in the code-
Java Code-
case 2://Opening a new Savings account
Console.Clear();
Console.WriteLine("Enter the customer's name");
savingsname=Console.ReadLine();
Console.WriteLine("Enter the initial amount");
initialamount=double.Parse(Console.ReadLine());
Console.WriteLine("Enter the number of years");
years=double.Parse(Console.ReadLine());
Console.WriteLine("Enter the interest rate");
rate=double.Parse(Console.ReadLine());
Interestamount=((initialamount*rate*years)/100);
savingsbalance=initialamount+Interestamount;
Console.WriteLine("A new Savings Account has been created");
break;
case 4://Deposit to savings account
Console.Clear();
Console.WriteLine("Enter the deposit amount");
amt=double.Parse(Console.ReadLine());
savingsbalance=savingsbalance+amt;
Console.WriteLine("{0} has been added to the account",amt);
Console.WriteLine("The balance is{0}",savingsbalance);
break;
case 5: //withdraw from checking amount
Console.Clear();
Console.WriteLine("Enter the withdraw amount");
amt1=double.Parse(Console.ReadLine());
checkingbalance=checkingbalance-amt1;
Console.WriteLine("{0} has been withdrawn from the account",amt1);
Console.WriteLine("The balance is{0}",checkingbalance);
break;
case 6: //withdraw from savings amount
Console.Clear();
Console.WriteLine("Enter the withdraw amount");
amt2=double.Parse(Console.ReadLine());
savingsbalance=savingsbalance-amt2;
Console.WriteLine("{0} has been withdrawn from the account",amt2);
Console.WriteLine("The balance is{0}",savingsbalance);
break;
case 8: //Balance enquiry from savings account
Console.Clear();
Console.WriteLine("{0} has {1} in his account",savingsname,savingsbalance);
break;