Write a C# program to help balance your bank account (initialize the balance to 0 in Main ()). The Main () method is to use a do-while loop to repeatedly prompt the user to enter a transaction (char) which could be 'w' or 'W' for withdrawal, 'd' or 'D' for deposit, 'p' or 'P' for print, and 'q' or 'Q' for quit. Using a switch statement in the do-while loop, select the appropriate action and call the appropriate user-defined method. The Main () method should continue accepting transactions until the user enters a 'Q' or 'q'. If the user wishes to withdraw or deposit, Main () is to invoke a user- defined method to input a non-negative amount. The program is to have four user-defined methods: (i) A double method call GetAmount which takes no formal parameters but returns a non-negative value representing the amount of a deposit or withdrawal. This method is to be invoked by Main() when the user chooses to either withdraw or deposit to their account. The method is to prompt the user to enter an amount and then validate that it is non-negative. The method header should look like: public static double GetAmount () (ii) A void method called Withdrawal which accepts one call by value formal parameter of type double (the amount of the withdrawal) an one by reference formal parameter of type double (the account balance). Withdrawal then deducts the amount of the from the balance. A $1.75 service charge is applied to each withdrawal. The withdrawal (and service charge) should not be applied if it would leave a negative balance and the customer should be warned (an error message should be printed). The method header should look like: public static void Withdrawal (double amount, ref double balance)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Write a C# program to help balance your bank account (initialize the balance to 0 in Main ()). The
Main () method is to use a do-while loop repeatedly prompt the user to enter a transaction (char)
which could be 'w' or 'W' for withdrawal, 'd' or 'D' for deposit, 'p' or 'P' for print, and 'q' or 'Q'
for quit. Using a switch statement in the do-while loop, select the appropriate action and call the
appropriate user-defined method. The Main () method should continue accepting transactions until
the user enters a 'Q' or 'q'. If the user wishes to withdraw or deposit, Main () is to invoke a user-
defined method to input a non-negative amount. The program is to have four user-defined methods:
(i) A double method call GetAmount which takes no formal parameters but returns a non-negative
value representing the amount of a deposit or withdrawal. This method is to be invoked by
Main() when the user chooses to either withdraw or deposit to their account. The method is to
prompt the user to enter an amount and then validate that it is non-negative. The method header
should look like:
public static double GetAmount ()
(ii) A void method called Withdrawal which accepts one call by value formal parameter of type
double (the amount of the withdrawal) and one call by reference formal parameter of type
double (the account balance). Withdrawal then deducts the amount of the from the balance. A
$1.75 service charge is applied to each withdrawal. The withdrawal (and service charge) should
not be applied if it would leave a negative balance and the customer should be warned (an error
message should be printed). The method header should look like:
public static void Withdrawal (double amount,
ref double balance)
Transcribed Image Text:Write a C# program to help balance your bank account (initialize the balance to 0 in Main ()). The Main () method is to use a do-while loop repeatedly prompt the user to enter a transaction (char) which could be 'w' or 'W' for withdrawal, 'd' or 'D' for deposit, 'p' or 'P' for print, and 'q' or 'Q' for quit. Using a switch statement in the do-while loop, select the appropriate action and call the appropriate user-defined method. The Main () method should continue accepting transactions until the user enters a 'Q' or 'q'. If the user wishes to withdraw or deposit, Main () is to invoke a user- defined method to input a non-negative amount. The program is to have four user-defined methods: (i) A double method call GetAmount which takes no formal parameters but returns a non-negative value representing the amount of a deposit or withdrawal. This method is to be invoked by Main() when the user chooses to either withdraw or deposit to their account. The method is to prompt the user to enter an amount and then validate that it is non-negative. The method header should look like: public static double GetAmount () (ii) A void method called Withdrawal which accepts one call by value formal parameter of type double (the amount of the withdrawal) and one call by reference formal parameter of type double (the account balance). Withdrawal then deducts the amount of the from the balance. A $1.75 service charge is applied to each withdrawal. The withdrawal (and service charge) should not be applied if it would leave a negative balance and the customer should be warned (an error message should be printed). The method header should look like: public static void Withdrawal (double amount, ref double balance)
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education