A- Computer Questions- SolutionsExam 2

A- Computer Questions- SolutionsExam 2 - Computer Question...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Question 1: Write Matlab code that performs the basic tasks of an ATM machine. The starting account balance is $500. Ask the user to enter a PIN, and accept any four digit integer. If they don’t enter a four digit integer as the PIN, your program should display “Incorrect PIN” and can stop right there. Now, display a menu asking the user whether he/she would like to deposit funds, withdraw funds, or display the account balance. Include a fourth menu item, “Return Card.” * If the user is depositing, ask how much to deposit and add it to the account balance. * If the user is withdrawing, allow withdrawing if there is enough money in the account and subtract it from the account balance. If there are insufficient funds, do not allow withdrawal and display an error message. Keep displaying the menu after each transaction (thus allowing additional transactions) until the user chooses “Return Card.” At that point, use fprintf to display the final account balance. balance=500; pin = input( 'Enter the PIN Number' ); if % Also OK: while (1) choice = menu( 'Choose action:' , 'Deposit Funds' , 'Withdraw Funds' , 'Check Account Balance' , 'Return Card' ); switch choice case
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/29/2012 for the course 440 127 taught by Professor Blase during the Fall '09 term at Rutgers.

Page1 / 3

A- Computer Questions- SolutionsExam 2 - Computer Question...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online