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
- The design of the gear-and-shaft system shown requires that steel shafts of the same diameter be used for both AB and CD. It is further required that the angle D through which end D of shaft CD rotates not exceed 1.5°. Knowing that G = 77.2 GPa, determine the required diameter of the shafts. 40 mm 400 mm 100 mm 600 mm T-1000 N-m Darrow_forwardAssume a Space Launch System (Figure 1(a)) that is approximated as a cantilever undamped single degree of freedom (SDOF) system with a mass at its free end (Figure 1(b)). The cantilever is assumed to be massless. Assume a wind load that is approximated with a concentrated harmonic forcing function p(t) = posin(ωt) acting on the mass. The known properties of the SDOF and the applied forcing function are given below. • Mass of SDOF: m =120 kip/g • Acceleration of gravity: g = 386 in/sec2 • Bending sectional stiffness of SDOF: EI = 1015 lbf×in2 • Height of SDOF: h = 2000 inches • Amplitude of forcing function: po = 6 kip • Forcing frequency: f = 8 Hzarrow_forward13.44 The end of a cylindrical liquid cryogenic propellant tank in free space is to be protected from external (solar) radiation by placing a thin metallic shield in front of the tank. Assume the view factor Fts between the tank and the shield is unity; all surfaces are diffuse and gray, and the surroundings are at 0 K. Tank T₁ Shield, T T₁ = 100 K E1 Solar irradiation Gs ε₁ = ε₂ = 0.05 ε₁ = 0.10 Gs = 1250 W/m² E2 Find the temperature of the shield T, and the heat flux (W/m²) to the end of the tank.arrow_forward
- question 664 thank youarrow_forward13.38 Consider the attic of a home located in a hot climate. The floor of the attic is characterized by a width of L₁ = 8 m while the roof makes an angle of 0 = 30° from the horizontal direction, as shown in the schematic. The homeowner wishes to reduce the heat load to the home by adhering bright aluminum foil (ε = 0.07) onto the surfaces of the attic space. Prior to installation of the foil, the surfaces are of emissivity & = 0.90. Attic A2, 82, T2 0 = 30° A1, E1, T₁ 土 L₁ = 8 m (a) Consider installation on the bottom of the attic roof only. Determine the ratio of the radiation heat transfer after to before the installation of the foil. (b) Determine the ratio of the radiation heat transfer after to before installation if the foil is installed only on the top of the attic floor. (c) Determine the ratio of the radiation heat transfer if the foil is installed on both the roof bottom and the floor top.arrow_forward13.1 Determine F2 and F2 for the following configura- tions using the reciprocity theorem and other basic shape factor relations. Do not use tables or charts. (a) Small sphere of area A, under a concentric hemi- sphere of area A₂ = 3A₁ A₂ A1 (a) (b) Long duct. Also, what is F₁₂? A₂ Αν (b) (c) Long inclined plates (point B is directly above the center of A₁) B 100 mm A₂ - 220 mm (c) (d) Long cylinder lying on infinite plane + A₁ Az (d) (e) Hemisphere-disk arrangement -A₂, hemisphere, diameter D A₂ A₁, disk, diameter D/2 (e) (f) Long, open channel 1 m AA₂ 2 m (f) (g) Long cylinders with A₁ = 4A₁. Also, what is F₁₂? -D₁ A1 -A₂ -D2 (e) (h) Long, square rod in a long cylinder. Also, what is F22? w=D/5 18 A₁ -A2 (h) -Darrow_forward
- 13.9 Determine the shape factor, F12, for the rectangles shown. 6 m 1 3 m 6 m 1 m 2 6 m 1 0.5 m 2 1 m (a) Perpendicular rectangles without a common edge. -1 m. (b) Parallel rectangles of unequal areas.arrow_forwardI keep getting the wrong answer i have gotten 6519.87 and 319.71arrow_forwardthank you for previous answer I apologize if the acceleration was unclear it is underlined now along with values in tablesarrow_forward
- ११११११११ TABLE Much 160,000kg Croll 0,005 CD Ap Par ng При nchs 0.15 5m² 1.2kg/m³ 0.98 0.9 0,98 0,9 0,88 IF 20 10 to add The train is going to make several stops along its journey. It will be important for the train to accelerate quickdy to get back up to speed. In order to get Tesla Model S motors until we get the combined The Forque and power needed we are goins bined power and forque needed to accelerate from 0 to 324 km/hr in less than 5 Minutes. Tesla Prated 270 kW Tesla Trated Twheel ng Jaxle 440 NM 20 8.5kgm² 0.45M a) What is the minimum whole number of Tesla Motors required to achieve accelerate the train from 0 to 324 km/hr in less than 5 Nnutes? Seperate the acceleration into constant torque and constant power 0. b) How long does it take the train to accelerate from 0 to 324 km/hr with the number of Tesla motors from part a? c) Using Matlab plot the relocity profile as a function of time, Is this a constant acceleration profile? Barrow_forwardExample find f(t)? -4s F(s)= (s² + 4)²arrow_forwarddraw a kinematic diagramarrow_forward
- Principles of Heat Transfer (Activate Learning wi...Mechanical EngineeringISBN:9781305387102Author:Kreith, Frank; Manglik, Raj M.Publisher:Cengage Learning
