For Exercises 3.16 -3.20, perform each of these steps:
- Read the problem statement.
- Formulate the
algorithm using pseudocode and top-down, stepwise refinement. - Write a C
program . - Test, debug and execute the C program.
(Credit-Limit Calculator) Develop a C program that will determine whether a department store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:
- Account number
- Balance at the beginning of the month
- Total of all items charged by this customer this month
- Total of all credits applied to this customer’s account this month
- Allowed credit limit
The program should input each fact, calculate the new balance (= beginning balance + charges — credits), and determine whether the new balance exceeds the customer’s credit limit. For those customers whose credit limit is exceeded, the program should display the customer’s account number, credit limit, new balance and the message “Credit limit exceeded.” Here is a sample input/output dialog:
Learn your wayIncludes step-by-step video
Chapter 3 Solutions
C How to Program (8th Edition)
Additional Engineering Textbook Solutions
Starting Out with C++: Early Objects
Problem Solving with C++ (10th Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
Introduction To Programming Using Visual Basic (11th Edition)
Problem Solving with C++ (9th Edition)
Starting Out with C++: Early Objects (9th Edition)
- (Thermodynamics) a. Design, write, compile, and run a program that determines the work,W, performed by a piston engine providing a force of 1000 N over a distance of 15 centimeters. The following formula is used to determine the work performed: W=Fd F is the force provided by the piston in Newtons. d is the distance the piston moves in meters. b. Manually check the values computed by your program. After verifying that your program is working correctly, modify it to determine the work performed by six pistons, each providing a force of 1500 N over a distance of 20 centimeters.arrow_forward(Acoustics) The loudness of a sound is measured in units of decibels and is calculated as shown: 10LOG(SL/RL) SL is the intensity of the sound being measured. RL is a reference sound-intensity level. Using this formula, write a C++ program that calculates and displays the decibel loudness of a busy street having a sound intensity of 10,000,000 RL. Verify your program’s result by doing a hand calculation. After verifying that your program is working correctly, use it to determine the sound level in decibels of the following sounds: a.Awhisperatsoundintensity200RLb.Arockbandplayingatsoundintensity1,000,000,000,000RLc.Anairplanetakingoffatsoundintensity100,000,000,000,000RLarrow_forward(Mechanics) The deflection at any point along the centerline of a cantilevered beam, such as the one used for a balcony (see Figure 5.15), when a load is distributed evenly along the beam is given by this formula: d=wx224EI(x2+6l24lx) d is the deflection at location x (ft). xisthedistancefromthesecuredend( ft).wistheweightplacedattheendofthebeam( lbs/ft).listhebeamlength( ft). Eisthemodulesofelasticity( lbs/f t 2 ).Iisthesecondmomentofinertia( f t 4 ). For the beam shown in Figure 5.15, the second moment of inertia is determined as follows: l=bh312 b is the beam’s base. h is the beam’s height. Using these formulas, write, compile, and run a C++ program that determines and displays a table of the deflection for a cantilevered pine beam at half-foot increments along its length, using the following data: w=200lbs/ftl=3ftE=187.2106lb/ft2b=.2fth=.3ftarrow_forward
- (General math) a. Write, compile, and run a C++ program to compute and display the value of the second-order polynomial ax2+bx+c for any user-entered values of the coefficients a, b, c, and the variable x. Have your program display a message to inform users what the program does, and then display suitable prompts to alert users to enter the data. (Hint: Use a prompt such as Enter the coefficient of the x-squared term:.) b. Check the result of your program written for Exercise 7a by using the following test data: Testdataset1:a=0,b=0,c=22,x=56Testdataset2:a=0,b=22,c=0,x=2Testdataset3:a=22,b=0,c=0,x=2Testdataset4:a=2,b=4,c=5,x=2 After finishing your verification, use your program to complete the following chartarrow_forward(Computation) Among other applications, Pascal’s triangle (see Figure 7.22) provides a means of determining the number of possible combinations of n things taken r at a time. For example, the number of possible combinations of five people (n = 5) taken two at a time (r=2)is10. Each row of the triangle begins and ends with 1. Every other element in a row is the sum of the element directly above it with the element to the left of the one above it. That is, element[n][r]=element[n1][r]+element[n1][r1] Using this information, write and test a C++ program to create the first 11 rows of a twodimensional array representing Pascal’s triangle. For any given value of n less than 11 and r less than or equal to n, the program should display the correct element. Use your program to determine in how many ways a committee of 8 can be selected from a group of 10 peoplearrow_forward(Conversion) a. Write a C++ program to convert meters to feet. The program should request the starting meter value, the number of conversions to be made, and the increment between metric values. The display should have appropriate headings and list the meters and the corresponding feet value. If the number of iterations is greater than 10, have your program substitute a default increment of 10. Use the relationship that 1 meter = 3.281 feet. b. Run the program written in Exercise 6a on a computer. Verify that your program begins at the correct starting meter value and contains the exact number of conversions specified in your input data. c. Modify the program written in Exercise 6a to request the starting meter value, the ending meter value, and the increment. Instead of the condition checking for a fixed count, the condition checks for the ending meter value. If the number of iterations is greater than 20, have your program substitute a default increment of (ending value - starting value) / 19.arrow_forward
- 1. Use C PROGRAMMING LANGUAGE ONLY 2. Use RECURSION type of program 3. Copy and paste your code(no need screenshot) 4. Screenshot the output 5. It should be USER-DEPENDENT 3. Write a C program containing a recursive function that will get the whole number quotient resull of dividing wo .integers n and m. (Example if n and m= 3, 4/3 = 1. Output 1)arrow_forwardPythonarrow_forwardPython Programming Part: Carbon-14 is constantly produced in Earth's upper atmosphere due to interaction between cosmic rays and nitrogen, and is found in all plants and animals. After a plant or animal died, its amount of carbon-14 decreases by about 0.012% per year. Write a python code to determine the half-life of carbon-14, that is, the number of years required for 1 gram of carbon-14 to decay to less than 1/2 gram. Example Output: Carbon-14 has a half-life of years. >>>arrow_forward
- C++arrow_forwardDiscrete Math /C++ No need to code.Upvote for very FAST and clear handwriting. Thank you. (2) Use logical equivalences to perform a direct proof that the two following logical statements are equivalent. Statement 1: !(P OR (!P AND Q)) Statement 2: !P AND !Qarrow_forwardNOTE: (what your answer will contain)1. Use C PROGRAMMING LANGUAGE ONLY2. Use RECURSION type of program3. Copy and paste your code(no need screenshot)4. Screenshot the output5. It should be USER-DEPENDENTarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr