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
MYPROGRAMMINGLAB WITH PEARSON ETEXT
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
- Module/Week 4 Assignment (Control Structures . While, For, Do, Case) You are burning some music CDs for a party. You have arranged a list of songs in the order you want to play them. However, you would like to maximize your use of space on the CD, which holds 80 minutes of music. To do so, you want to figure out the total time for a group of songs and see how well they fit. Write a design and a C++ program to help you accomplish this task. The data are on file “songs.txt” (which is provided for you). The time is entered as seconds. For example, if a song takes 7 minutes and 42 seconds to play, the data entered for that song would be 462. After all the data has been read, the application should print a message indicating the time remaining on the CD. The output must be in the form of a table with columns and headings written on a file. For example: Note: the output converts the input from seconds to minutes and seconds. Use meaningful variable names, proper indentation, and…arrow_forwardCourse Number СРЕ161 Course Title Programming Logic and Design1 Implement programs involving the use of while, do..while and for loop statement. Objectives: Topics Covered: Iteration, Nested Loops Description Write a C program that will input 10 names of student. Each student name has 4 exam scores |(0 – 100). Determine and display the average score of each student. Output also the name of students whose average score is between greater than or equal to 75.arrow_forwardInstructions: Complete the first 3 steps of problem-solving for each of the following scenarios. Do not include flow charts. Present enough “pen and paper analysis” to demonstrate a stepwise solution to the problem. Scenarios: Find all the prime numbers less than 1000 Alphabetize a list of 10 names Calculate and output a paycheck including hours worked, overtime, and rate of payarrow_forward
- Need help PYTHON PROGRAMMING ONLY PLEASE NUMBER 12arrow_forwardObjectives: Implement programs involving the use of while, do..while and for loop statement. Topics Covered: Iteration, Nested Loops Description Write a C program that will input 10 names of student. Each student name has 4 exam scores (0-100). Determine and display the average score of each student. Output also the name of students whose average score is between greater than or equal to 75. Sample Output if Applicablearrow_forwardMake a flowchartarrow_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