SlideShare a Scribd company logo
1 of 1
Write a program that simulates a mini ATM. Requirements - Define a function named main - It
has no formal parameters and does not need header documentation. - Create a local variable
(inside main) named balance and assign it an initial value of 1500. - Use a while loop that repeats
until the user enters an e or E for the menu choice. The loop condition is what terminates the
loop. You could assign the empty string to a variable named choice just before the loop in order
to get into the loop initially. Inside the loop: - Call the getMenuChoice() function (discussed
below) to present the menu and get the customer's banking choice. The choice will be returned
by this function and can be stored into a local variable named choice - Use a multi-branching if
statement to process a customer choice of W, D, or B. You won't need to handle an E because
the loop condition will terminate. - W Get the amount to withdraw. Respond with error messages
if the amount entered is less than or equal to zero or if the amount is greater than the balance. See
the sample runs for the error messages. Otherwise, deduct the withdraw amount from the balance
and tell the user to take their amount purchased. Again see the output in the sample run-you are
required to display a preceding S , 2 digits of precision, and automatically insert thousands
separators. A properly constructed f -string must be used. - D Get the amount to deposit.
Respond with an error message if the amount entered is 0 or negative. See the sample runs for
the error message. Otherwise, add the deposited amount to the balance. - B Display the balance
in the format shown in the sample run. You are required to display a preceding $ , 2 digits of
precision, and automatically insert thousands separators. A properly constructed f -string must be
used. After the loop terminates display the exit message shown in the sample run Insert at least
two comments in main that describe chunks of code (use action verbs.) However, if performing
the optional code modification described below, these comments aren't needed. - Define a
function named getMenuChoice. It has no formal parameters and will present the menu exactly
as shown in the sample run with beginning and ending lines of = symbols. It prompts the
customer for a choice and returns that choice in uppercase form. The function header docs are
provided below and are to be placed on the top of the getMenuChoice definition #
getMenuChoice presents a banking menu of choices # @return The customer's menu choice as a
single upper # case letter. - Be sure to create a line of code that calls main() after the function
definitions. - There will be no global variables. Any variables are created inside the functions. -
Match the exact output shown below. Remember that input prompts are also part of the output.
Note where a blank line is output. - Follow all coding style guidelines presented thus far.

More Related Content

Similar to Write a program that simulates a mini ATM- Requirements - Define a fun.docx

Directions Flexible Budget Performance Report Project  You a.docx
Directions Flexible Budget Performance Report Project  You a.docxDirections Flexible Budget Performance Report Project  You a.docx
Directions Flexible Budget Performance Report Project  You a.docx
mariona83
 
Directions Flexible Budget Performance Report Project  You a.docx
Directions Flexible Budget Performance Report Project  You a.docxDirections Flexible Budget Performance Report Project  You a.docx
Directions Flexible Budget Performance Report Project  You a.docx
cuddietheresa
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
gilbertkpeters11344
 
someone help Python programming After the loop ends, return the expe.pdf
someone help Python programming After the loop ends, return the expe.pdfsomeone help Python programming After the loop ends, return the expe.pdf
someone help Python programming After the loop ends, return the expe.pdf
ishratmanzar1986
 
Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7
ashhadiqbal
 

Similar to Write a program that simulates a mini ATM- Requirements - Define a fun.docx (6)

Directions Flexible Budget Performance Report Project  You a.docx
Directions Flexible Budget Performance Report Project  You a.docxDirections Flexible Budget Performance Report Project  You a.docx
Directions Flexible Budget Performance Report Project  You a.docx
 
Directions Flexible Budget Performance Report Project  You a.docx
Directions Flexible Budget Performance Report Project  You a.docxDirections Flexible Budget Performance Report Project  You a.docx
Directions Flexible Budget Performance Report Project  You a.docx
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
 
someone help Python programming After the loop ends, return the expe.pdf
someone help Python programming After the loop ends, return the expe.pdfsomeone help Python programming After the loop ends, return the expe.pdf
someone help Python programming After the loop ends, return the expe.pdf
 
Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7
 
Comp 220 lab 3
Comp 220 lab 3Comp 220 lab 3
Comp 220 lab 3
 

More from DavidgflFishery

More from DavidgflFishery (20)

Which of the following is formed from a cholesterol -backbone- Aldoste.docx
Which of the following is formed from a cholesterol -backbone- Aldoste.docxWhich of the following is formed from a cholesterol -backbone- Aldoste.docx
Which of the following is formed from a cholesterol -backbone- Aldoste.docx
 
Which of these groups are the closest living relatives of animals- a-.docx
Which of these groups are the closest living relatives of animals- a-.docxWhich of these groups are the closest living relatives of animals- a-.docx
Which of these groups are the closest living relatives of animals- a-.docx
 
Which of the following statements about the reproductive biology of fu (1).docx
Which of the following statements about the reproductive biology of fu (1).docxWhich of the following statements about the reproductive biology of fu (1).docx
Which of the following statements about the reproductive biology of fu (1).docx
 
Which of the following is most influenced by the SRY gene- gender iden.docx
Which of the following is most influenced by the SRY gene- gender iden.docxWhich of the following is most influenced by the SRY gene- gender iden.docx
Which of the following is most influenced by the SRY gene- gender iden.docx
 
Which of the following is NOT one of the arguments managers typically.docx
Which of the following is NOT one of the arguments managers typically.docxWhich of the following is NOT one of the arguments managers typically.docx
Which of the following is NOT one of the arguments managers typically.docx
 
Which of the following is-are assumptions of the Hardy-Weinberg theore.docx
Which of the following is-are assumptions of the Hardy-Weinberg theore.docxWhich of the following is-are assumptions of the Hardy-Weinberg theore.docx
Which of the following is-are assumptions of the Hardy-Weinberg theore.docx
 
Which of the following is not a correct way to state a null hypothesis.docx
Which of the following is not a correct way to state a null hypothesis.docxWhich of the following is not a correct way to state a null hypothesis.docx
Which of the following is not a correct way to state a null hypothesis.docx
 
Which of the following is not an example of a deductible temporary dif (1).docx
Which of the following is not an example of a deductible temporary dif (1).docxWhich of the following is not an example of a deductible temporary dif (1).docx
Which of the following is not an example of a deductible temporary dif (1).docx
 
Which of the following is TRUE with regard to primase- It is responsib.docx
Which of the following is TRUE with regard to primase- It is responsib.docxWhich of the following is TRUE with regard to primase- It is responsib.docx
Which of the following is TRUE with regard to primase- It is responsib.docx
 
Which of the following is true regarding keratin- a- it is actually a.docx
Which of the following is true regarding keratin-  a- it is actually a.docxWhich of the following is true regarding keratin-  a- it is actually a.docx
Which of the following is true regarding keratin- a- it is actually a.docx
 
Which of the following is true about using monocultures in agriculture.docx
Which of the following is true about using monocultures in agriculture.docxWhich of the following is true about using monocultures in agriculture.docx
Which of the following is true about using monocultures in agriculture.docx
 
Which of the following statements is (are) true- Firms are motivated t.docx
Which of the following statements is (are) true- Firms are motivated t.docxWhich of the following statements is (are) true- Firms are motivated t.docx
Which of the following statements is (are) true- Firms are motivated t.docx
 
Which of the following statements best describes a hormone- A hommone.docx
Which of the following statements best describes a hormone- A hommone.docxWhich of the following statements best describes a hormone- A hommone.docx
Which of the following statements best describes a hormone- A hommone.docx
 
Which of the following was an interesting result from the Griffith exp.docx
Which of the following was an interesting result from the Griffith exp.docxWhich of the following was an interesting result from the Griffith exp.docx
Which of the following was an interesting result from the Griffith exp.docx
 
Which of the following steps are a part of QTL association studies- br.docx
Which of the following steps are a part of QTL association studies- br.docxWhich of the following steps are a part of QTL association studies- br.docx
Which of the following steps are a part of QTL association studies- br.docx
 
Which of the following is NOT a scenario that would call for the forma.docx
Which of the following is NOT a scenario that would call for the forma.docxWhich of the following is NOT a scenario that would call for the forma.docx
Which of the following is NOT a scenario that would call for the forma.docx
 
Which of the following is correctly paired- Two answer choices are cor.docx
Which of the following is correctly paired- Two answer choices are cor.docxWhich of the following is correctly paired- Two answer choices are cor.docx
Which of the following is correctly paired- Two answer choices are cor.docx
 
Which of the following statements about -deepening- and-or -widening-.docx
Which of the following statements about -deepening- and-or -widening-.docxWhich of the following statements about -deepening- and-or -widening-.docx
Which of the following statements about -deepening- and-or -widening-.docx
 
Which of the following items would be considered 'fossils' when dug ou.docx
Which of the following items would be considered 'fossils' when dug ou.docxWhich of the following items would be considered 'fossils' when dug ou.docx
Which of the following items would be considered 'fossils' when dug ou.docx
 
Which of the following is NOT correct about the Golgi apparatus- Defec.docx
Which of the following is NOT correct about the Golgi apparatus- Defec.docxWhich of the following is NOT correct about the Golgi apparatus- Defec.docx
Which of the following is NOT correct about the Golgi apparatus- Defec.docx
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 

Write a program that simulates a mini ATM- Requirements - Define a fun.docx

  • 1. Write a program that simulates a mini ATM. Requirements - Define a function named main - It has no formal parameters and does not need header documentation. - Create a local variable (inside main) named balance and assign it an initial value of 1500. - Use a while loop that repeats until the user enters an e or E for the menu choice. The loop condition is what terminates the loop. You could assign the empty string to a variable named choice just before the loop in order to get into the loop initially. Inside the loop: - Call the getMenuChoice() function (discussed below) to present the menu and get the customer's banking choice. The choice will be returned by this function and can be stored into a local variable named choice - Use a multi-branching if statement to process a customer choice of W, D, or B. You won't need to handle an E because the loop condition will terminate. - W Get the amount to withdraw. Respond with error messages if the amount entered is less than or equal to zero or if the amount is greater than the balance. See the sample runs for the error messages. Otherwise, deduct the withdraw amount from the balance and tell the user to take their amount purchased. Again see the output in the sample run-you are required to display a preceding S , 2 digits of precision, and automatically insert thousands separators. A properly constructed f -string must be used. - D Get the amount to deposit. Respond with an error message if the amount entered is 0 or negative. See the sample runs for the error message. Otherwise, add the deposited amount to the balance. - B Display the balance in the format shown in the sample run. You are required to display a preceding $ , 2 digits of precision, and automatically insert thousands separators. A properly constructed f -string must be used. After the loop terminates display the exit message shown in the sample run Insert at least two comments in main that describe chunks of code (use action verbs.) However, if performing the optional code modification described below, these comments aren't needed. - Define a function named getMenuChoice. It has no formal parameters and will present the menu exactly as shown in the sample run with beginning and ending lines of = symbols. It prompts the customer for a choice and returns that choice in uppercase form. The function header docs are provided below and are to be placed on the top of the getMenuChoice definition # getMenuChoice presents a banking menu of choices # @return The customer's menu choice as a single upper # case letter. - Be sure to create a line of code that calls main() after the function definitions. - There will be no global variables. Any variables are created inside the functions. - Match the exact output shown below. Remember that input prompts are also part of the output. Note where a blank line is output. - Follow all coding style guidelines presented thus far.