
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: An Active Learning Approach, Student Value Edition (4th Edition)
- Please find the torsional yield strength, the yield strength, the spring index, and the mean diameter. Use: E = 28.6 Mpsi, G = 11.5 Mpsi, A = 140 kpsi·in, m = 0.190, and relative cost= 1.arrow_forwardA viscoelastic column is made of a material with a creep compliance of D(t)= 0.75+0.5log10t+0.18(log10t)^2 GPA^-1 for t in s. If a constant compressive stress of σ0 = –100 MPa is applied at t = 0, how long will it take (= t1/2) for the height of the column to decrease to ½ its original value? Note: You will obtain multiple answers for this problem! One makes sense physically and one does not.arrow_forwardA group of 23 power transistors, dissipating 2 W each, are to be cooled by attaching them to a black-anodized square aluminum plate and mounting the plate on the wall of a room at 30°C. The emissivity of the transistor and the plate surfaces is 0.9. Assuming the heat transfer from the back side of the plate to be negligible and the temperature of the surrounding surfaces to be the same as the air temperature of the room, determine the length of the square plate if the average surface temperature of the plate is not to exceed 50°C. Start the iteration process with an initial guess of the size of the plate as 43 cm. The properties of air at 1 atm and the film temperature of (Ts + T)/2 = (50 + 30)/2 = 40°C are k = 0.02662 W/m·°C, ν = 1.702 × 10–5 m2 /s, Pr = 0.7255, and β = 0.003195 K–1. Multiple Choice 0.473 m 0.284 m 0.513 m 0.671 marrow_forward
- A 40-cm-diameter, 127-cm-high cylindrical hot water tank is located in the bathroom of a house maintained at 20°C. The surface temperature of the tank is measured to be 44°C and its emissivity is 0.4. Taking the surrounding surface temperature to be also 20°C, determine the rate of heat loss from all surfaces of the tank by natural convection and radiation. The properties of air at 32°C are k=0.02603 W/m-K, v=1.627 x 10-5 m²/s, Pr = 0.7276, and ẞ = 0.003279 K-1 The rate of heat loss from all surfaces of the tank by natural convection is The rate of heat loss from all surfaces of the tank by radiation is W. W.arrow_forwardA 2.5-m-long thin vertical plate is subjected to uniform heat flux on one side, while the other side is exposed to cool air at 5°C. The plate surface has an emissivity of 0.73, and its midpoint temperature is 55°C. Determine the heat flux subjected on the plate surface. Uniform heat flux -Plate, € = 0.73 Cool air 5°C 7 TSUIT Given: The properties of water at Tf,c= 30°C. k=0.02588 W/m.K, v=1.608 x 10-5 m²/s Pr = 0.7282 The heat flux subjected on the plate surface is W/m²arrow_forwardHot water is flowing at an average velocity of 5.82 ft/s through a cast iron pipe (k=30 Btu/h-ft-°F) whose inner and outer diameters are 1.0 in and 1.2 in, respectively. The pipe passes through a 50-ft-long section of a basement whose temperature is 60°F. The emissivity of the outer surface of the pipe is 0.5, and the walls of the basement are also at about 60°F. If the inlet temperature of the water is 150°F and the heat transfer coefficient on the inner surface of the pipe is 30 Btu/h-ft².°F, determine the temperature drop of water as it passes through the basement. Evaluate air properties at a film temperature of 105°C and 1 atm pressure. The properties of air at 1 atm and the film temperature of (Ts+ T∞)/2 = (150+60)/2 = 105°F are k=0.01541 Btu/h-ft-°F. v=0.1838 × 10-3 ft2/s, Pr = 0.7253, and ẞ = 0.00177R-1arrow_forward
- hand-written solutions only, please. correct answers upvoted!arrow_forwardhand-written solutions only, please. correct answers upvoted!arrow_forward! Required information Consider a flat-plate solar collector placed horizontally on the flat roof of a house. The collector is 1.3 m wide and 2.8 m long, and the average temperature of the exposed surface of the collector is 42°C. The properties of air at 1 atm and the film temperature are k=0.02551 W/m-°C, v = 1.562 × 10-5 m²/s, Pr = 0.7286, and ẞ= 0.003356 K-1 Determine the rate of heat loss from the collector by natural convection during a calm day when the ambient air temperature is 8°C. The rate of heat loss from the collector by natural convection is W.arrow_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





