![Thinking Like an Engineer: An Active Learning Approach (3rd Edition)](https://www.bartleby.com/isbn_cover_images/9780133593211/9780133593211_largeCoverImage.gif)
Concept explainers
You are to program part of the interface for a simple atm. When the user inserts their card and types the correct pin (you do NOT have to write this part of the program), the system will place the users’ checking account balance balance in a variable CBal and the users’ saving account balance in SBal.
You are to write a function that will accept SBal and CBal as inputs and return two variables NewCBal and NewCBal containing the checking and savings balances after the transaction is completed. The function should do the following:
- Display a menu titled “Main Menu” with the following three options.
- Get cash
- Get balance
- Quit
- If “Get cash” is selected, another menu titled “Withdrawal amount” with the following four items is displayed:
- $20
- $60
- $100
- $200
- After selecting an amount, a menu titled “From which amount?” should be displayed showing the following two options:
- Checking
- Savings
- At this point, the program should verify that the selected amount contains sufficient funds for the requested withdrawal.
- If not, a message should be displayed that says, “Sorry. You do not have sufficient funds in your SSSS account to withdraw $XX” where SSSS is either Savings or Checking and $XX is the selected withdrawal amount.
- It funds are available, the program should call a function Disp20(x), where x is the number of $20 bills to dispense. (See the following note about Disp20.) After that, the withdrawal amount should be subtracted from the appropriate balance.
- After processing the “Get cash” request, the program should return to the main menu.
Note About Disp20(x): The purpose of this function is to dispense the requested number of $20 bills—that is, to shove x bills out of the slot in the ATM machine. This does not really exist since we do not have an ATM machine to work with. Thus, if you try to run your code, you will get an error (“Undefined function..”).
In order to test your program, add the following function to your current path:
Where x is the number of bills to be dispensed.
This allows you to know if the program reached the proper location in the code. It is fairly common in software development to use a “dummy” function in the place of a real one when the device to be controlled has not been completed or is not available in order to help verify whether the software is reaching the correct places in the code for various situations.
- If “Get Balance” is selected, another menu titled “Which account?” should appear with the two choices:
- Checking
- Savings
and the program should then display “Your SSSS balance is $bb.bb.,” where SSSS is either Savings or Checking and $bb.bb is the balance in the selected account.
- After processing the “Get balance” request the program should return to the main menu.
- If Quit is selected, the function should return to the calling program with the updated balances in NewCBal and NewSBal. Note that the new balances will be equal to the original balances if no money was drawn from an account, but they must still be returned in the two new balance variables.
If the user closes a menu rather than making a selection, a warning message should be displayed and the user given two more chances to make a selection from that menu. If they still close the menu on the third attempt, an error message should be displayed and control should return to the main program after making sure that NewCBal and NewSBal were set as appropriate based on earlier transactions.
![Check Mark](/static/check-mark.png)
Want to see the full answer?
Check out a sample textbook solution![Blurred answer](/static/blurred-answer.jpg)
Chapter 20 Solutions
Thinking Like an Engineer: An Active Learning Approach (3rd Edition)
- (read me)arrow_forward(read image)arrow_forwardQu. 13 What are the indices for the Direction 2 indicated by vector in the following sketch? Qu. 14 Determine the indices for the direction A and B shown in the following cubic unit cell. please show all work step by step from material engineeringarrow_forward
- The thin-walled open cross section shown is transmitting torque 7. The angle of twist ₁ per unit length of each leg can be determined separately using the equation 01 = 3Ti GLIC 3 where G is the shear modulus, ₁ is the angle of twist per unit length, T is torque, and L is the length of the median line. In this case, i = 1, 2, 3, and T; represents the torque in leg i. Assuming that the angle of twist per unit length for each leg is the same, show that T= Lic³ and Tmaz = G01 Cmax Consider a steel section with Tallow = 12.40 kpsi. C1 2 mm L1 20 mm C2 3 mm L2 30 mm C3 2 mm L3 25 mm Determine the torque transmitted by each leg and the torque transmitted by the entire section. The torque transmitted by the first leg is | N-m. The torque transmitted by the second leg is N-m. The torque transmitted by the third leg is N-m. The torque transmitted by the entire section is N-m.arrow_forwardPlease help, make sure it's to box out and make it clear what answers go where...arrow_forwardThe cylinder floats in the water and oil to the level shown. Determine the weight of the cylinder. (rho)o=910 kg/m^3arrow_forward
- Elements Of ElectromagneticsMechanical EngineeringISBN:9780190698614Author:Sadiku, Matthew N. O.Publisher:Oxford University PressMechanics of Materials (10th Edition)Mechanical EngineeringISBN:9780134319650Author:Russell C. HibbelerPublisher:PEARSONThermodynamics: An Engineering ApproachMechanical EngineeringISBN:9781259822674Author:Yunus A. Cengel Dr., Michael A. BolesPublisher:McGraw-Hill Education
- Control Systems EngineeringMechanical EngineeringISBN:9781118170519Author:Norman S. NisePublisher:WILEYMechanics of Materials (MindTap Course List)Mechanical EngineeringISBN:9781337093347Author:Barry J. Goodno, James M. GerePublisher:Cengage LearningEngineering Mechanics: StaticsMechanical EngineeringISBN:9781118807330Author:James L. Meriam, L. G. Kraige, J. N. BoltonPublisher:WILEY
![Text book image](https://www.bartleby.com/isbn_cover_images/9780190698614/9780190698614_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780134319650/9780134319650_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781259822674/9781259822674_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781118170519/9781118170519_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337093347/9781337093347_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781118807330/9781118807330_smallCoverImage.gif)