Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

programming language must be in c++ What this Assignment Is About: Learn to declare, define and call void & non-void functions. Important This is an

programming language must be in c++ image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
What this Assignment Is About: Learn to declare, define and call void & non-void functions. Important This is an individual assignment, please do not collaborate. Make sure that you write every line of your own code. Using code written by someone else will be considered a violation of the academic integrity and will result in a report sent to the Dean's office Coding Guidelines for All Labs/Assignments (You will be graded on this) e Give identifiers semantic meaning and make them easy to read (examples numStudents grossPay, etc). e Keep identifiers to a reasonably short length. e Use upper case for constants. Use title case (first letter is upper case) for classes. Use lower case with uppercase word separators for all other identifiers (variables, methods, objects). e Use tabs or spaces to indent code within blocks (code surrounded by braces). This includes classes, methods, and code associated with ifs, switches and loops. Be consistent with the number of spaces or tabs that you use to indent Use white space to make your program Use comments properly before or after the ending brace of classes, methods, and blocks to identify to which block it belongs. your program more readable. e File provided (right-click, then pick "Save Target as" to download the file) Assignment description 1. Introduction In this assignment, you're required to write a program that simulates a Bank of America ATM machine. Once run, the ATM machine has the following options: Welcome to Bank of America D: Deposit W: Withdraw C: Check Balance E: Currency Exchange Q: Quit The program then allows the user to enter his/her option as follows: Enter your option: For each of above option, below please find its description. The program will repeat until user pick an option 'Q. Note: the program should allow user to enter both upper and low case of a letter. For example, both d and D represent deposit, etc. Option is option allows user to deposit certain amount of US dollars into is/her account. Note: the deposit amount must be positive; if the user to deposite a negative amount, his/her account balance should NOT changed and the follow message should be shown on screen: sit amount can't be ative is option allows user to withdraw certain amount of US dollars from r account. Note: the withdraw amount cannot exceed the current i.e. if an account has $1000.00 in it, but the user want to w S1500.00, a warning message, plus the current balance should printed on screen as follows: orry, insufficient amount to withdraw Your current balance is: $1000.00 s option simply shows the account's current balance on screen. Note balance need to be formatted as currency, i.e. with S in front two decimal digits. our current balance is: $1000.00 is option allows user to withdraw certain amount of US dollars from is/her own account, then convert it into a foreign currency he/she ick. Currently Bank of America only provides currency exchange to 15 foreign currencies. Each foreign currency is represented y a three letter abrreviation code, such as CAD represents Canadian ar and MXN represents Mexican Peso, etc. The foreign currency code and its exchange rate can be found inside a text file ExchangeRate.txt First the 'E' option should ask user which foreign currency he/she t to exchange to, the user then enter a currency abbreviation code, n case he/she entered a wrong code, such as ABC which doesn't exist the file, the program should show the following message on urrency abbreviation code doesn't exist. If user enter a valid currency abbreviation code, such as CAD or MXN program then asks the user for the amount he/she want to exchange. a user cannot exchange/withdraw an amount which exceeds is/her current balance, otherwise the following message should be on screen: orry, insufficient amount to withdraw Your current balance is: $500.00 If a user successfully exchanged certain amount of US dollars into a ign currency, update his/her balance and show, for example the g message on screen: S$ 200.00 is chan is option termniates the to 3852.90 MXN 2. Functions In this assignment, your program MUST at least include the following functions, feel free to add any extra functions if necessary. Deseriptie is is the main) function which we will start the program with. code for the main function can be as follows, but do feel free to your own main structure if you'd like. //show option on screen //get user's option switch (option) case 'D' or 'd: I/code to handle deposit case 'W' or :/code to handle withdraw case "c" or "". //code to check balance case E' or 'e.. //code for currency break; break; break xchange break: default: //Invalid option ) while (option-'Q &option ); is function simply display the following menu on screen: Welcome to Bank of America # : Deposit : Withdraw : Check Balance : Currency Exchange : Quit showoption is function takes a deposit amount as input parameter and it returns accordingly if the deposit amount and updates lowing message on screen posit amount can't be negative the account balance s greater or equals to 0; otherwise, it returns false and show the is function takes a withdraw amount as input parameter. The amount must be greater or equals to 0, otherwise the function false and show the following error message on screen: ithdraw amount cannot be negative. If withdraw amount if positive, but exceeds the current account balance the functions returns false and show the following message on screen withdraw Sorry, insufficient amount to withdraw. Your current balance is: $???.?? therwise the function updates the account balance accordingly and turns true his function simply returns the current balance of the account. his function takes a foreign currency's abbreviation code, such as AD (Canadian dollar) or MXN (Mexico Peso) as input parameter, it checkBalance then open a file called ExchangeRate.txt and return the relevant checkExchangeRate curency exchange rate accordingly If user enters an abbreviation code which doesn't exist inside the file, it turns -1 his function takes two input parameters, one is the amount of US ollars that the user want to convert to a foreign currency, another one currencyExchange is the exchange rate, the function returns the relevant foreign currency amount Note: Except for main0, for all above functions, you need to decide its header first, this includes the return data tye and formal parameter list. For formal parameter list, you will need to decide the number, data type of each parameter, etc Don't forget to declare the functions first. The only global variable you might declare and use is for the account balance, nothing else! If you declared or used any other global variables, 2 pts will be deducted! . For foreign currency abbreviation code, case matters, in other words, if user entered cad (instead of CAD) to exchange US dollars into Canadian dollars, the function checkExchangeRate should return -1. You can check this website for each of the abbreviation code . Account balance should be formatted with 2 decimal digits

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

6. What is a Bernoulli trial?

Answered: 1 week ago

Question

Have I incorporated my research into my outline effectively?

Answered: 1 week ago