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.

Want to see the full answer?
Check out a sample textbook solution
Chapter 19 Solutions
THINKING LIKE AN ENGINEER W/ACCESS
- using the theorem of three moments, find all the reactions and supportsarrow_forward(An ellipsoidal trapping region for the Lorenz equations) Show that there is a certain ellipsoidal region E of the form rx2 + σy2 + σ(z − 2r)2 ≤ C such that all trajectories of the Lorenz equations eventually enter E and stay in there forever. For a much stiffer challenge, try to obtain the smallest possible value of C with this property.arrow_forwardA) In a factory, an s-type pitot tube was used to calculate the velocity of dry air for a point inside a stack. Calculate the velocity at that point (ft/sec) using following conditions: ● • • Pressure = 30.23 ± 0.01 in Hg (ambient) Pitot tube coefficient = 0.847 ± 0.03 Temperature = 122 ± 0.1 F (stack) Temperature = 71.2 ± 0.1 F (ambient) AP = 0.324 ± 0.008 in H2O (pitot tube) • AP = 0.891 ± 0.002 in H2O (stack) B) Find the dominant error(s) when determining precision for the problem. C) For part A, what is the precision in ft/sec for the velocity?arrow_forward
- Q1/ For what value of x do the power series converge: 8 (-1)n-1. x2n-1 2n-1 x3 x5 = X n=1 3 Q2/ Find the Interval of convergence and Radius of convergence of the series: 8 n Σ 3+1 n=1 (x)"arrow_forwardExample-1: l D A uniform rotor of length 0.6 m and diameter 0.4 m is made of steel (density 7810 kg/m³) is supported by identical short bearings of stiffness 1 MN/m in the horizontal and vertical directions. If the distance between the bearings is 0.7 m, determine the natural frequencies and plot whirl speed map. Solution: Barrow_forwardfind the laplace transform for the flowing function 2(1-e) Ans. F(s)=- S 12) k 0 Ans. F(s)= k s(1+e) 0 a 2a 3a 4a 13) 2+ Ans. F(s)= 1 s(1+e") 3 14) f(t)=1, 0arrow_forwardFind the solution of the following Differential Equations Using Laplace Transforms 1) 4y+2y=0. y(0)=2. y'(0)=0. 2) y+w²y=0, (0)=A, y'(0)=B. 3) +2y-8y 0. y(0)=1. y'(0)-8. 4)-2-3y=0, y(0)=1. y'(0)=7. 5) y-ky'=0, y(0)=2, y'(0)=k. 6) y+ky'-2k²y=0, y(0)=2, y'(0) = 2k. 7) '+4y=0, y(0)=2.8 8) y+y=17 sin(21), y(0)=-1. 9) y-y-6y=0, y(0)=6, y'(0)=13. 10) y=0. y(0)=4, y' (0)=0. 11) -4y+4y-0, y(0)=2.1. y'(0)=3.9 12) y+2y'+2y=0, y(0)=1, y'(0)=-3. 13) +7y+12y=21e". y(0)=3.5. y'(0)=-10. 14) "+9y=10e". y(0)=0, y'(0)=0. 15) +3y+2.25y=91' +64. y(0)=1. y'(0) = 31.5 16) -6y+5y-29 cos(2t). y(0)=3.2, y'(0)=6.2 17) y+2y+2y=0, y(0)=0. y'(0)=1. 18) y+2y+17y=0, y(0)=0. y'(0)=12. 19) y"-4y+5y=0, y(0)=1, y'(0)=2. 20) 9y-6y+y=0, (0)-3, y'(0)=1. 21) -2y+10y=0, y(0)=3, y'(0)=3. 22) 4y-4y+37y=0, y(0)=3. y'(0)=1.5 23) 4y-8y+5y=0, y(0)=0, y'(0)=1. 24) ++1.25y-0, y(0)=1, y'(0)=-0.5 25) y 2 cos(r). y(0)=2. y'(0) = 0. 26) -4y+3y-0, y(0)=3, y(0) 7. 27) y+2y+y=e y(0)=0. y'(0)=0. 28) y+2y-3y=10sinh(27), y(0)=0. y'(0)=4. 29)…arrow_forwardAuto Controls A union feedback control system has the following open loop transfer function where k>0 is a variable proportional gain i. for K = 1 , derive the exact magnitude and phase expressions of G(jw). ii) for K = 1 , identify the gaincross-over frequency (Wgc) [where IG(jo))| 1] and phase cross-overfrequency [where <G(jw) = - 180]. You can use MATLAB command "margin" to obtain there quantities. iii) Calculate gain margin (in dB) and phase margin (in degrees) ·State whether the closed-loop is stable for K = 1 and briefly justify your answer based on the margin . (Gain marginPhase margin) iv. what happens to the gain margin and Phase margin when you increase the value of K?you You can use for loop in MATLAB to check that.Helpful matlab commands : if, bode, margin, rlocus NO COPIED SOLUTIONSarrow_forwardThe 120 kg wheel has a radius of gyration of 0.7 m. A force P with a magnitude of 50 N is applied at the edge of the wheel as seen in the diagram. The coefficient of static friction is 0.3, and the coefficient of kinetic friction is 0.25. Find the acceleration and angular acceleration of the wheel.arrow_forwardAuto Controls Using MATLAB , find the magnitude and phase plot of the compensators NO COPIED SOLUTIONSarrow_forward4-81 The corner shown in Figure P4-81 is initially uniform at 300°C and then suddenly exposed to a convection environment at 50°C with h 60 W/m². °C. Assume the = 2 solid has the properties of fireclay brick. Examine nodes 1, 2, 3, 4, and 5 and deter- mine the maximum time increment which may be used for a transient numerical calculation. Figure P4-81 1 2 3 4 1 cm 5 6 1 cm 2 cm h, T + 2 cmarrow_forwardAuto Controls A union feedback control system has the following open loop transfer function where k>0 is a variable proportional gain i. for K = 1 , derive the exact magnitude and phase expressions of G(jw). ii) for K = 1 , identify the gaincross-over frequency (Wgc) [where IG(jo))| 1] and phase cross-overfrequency [where <G(jw) = - 180]. You can use MATLAB command "margin" to obtain there quantities. iii) Calculate gain margin (in dB) and phase margin (in degrees) ·State whether the closed-loop is stable for K = 1 and briefly justify your answer based on the margin . (Gain marginPhase margin) iv. what happens to the gain margin and Phase margin when you increase the value of K?you You can use for loop in MATLAB to check that.Helpful matlab commands : if, bode, margin, rlocus NO COPIED SOLUTIONSarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- 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





