C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 2, Problem 34SA
Explanation of Solution
For the program, the inputs that need to be provided are given in the following order:
Input for the variable productName of type string, example, "Biscuits" corresponding to the statement
cin >> productName;
Input for the variable salesTaxRate of type double, example 10.5 corresponding to the first stream extraction operator >> in the statement
cin >> salesTaxRate...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Topic: Recursive Function
A bank increases the interest rate it gives to its customers by 1% every month the money stays in the bank. Write the recursive function that calculates the total amount of money at the end of the maturity date, based on the condition below.
The parameters of the function: capital, initial interest rate and maturity date(months)
Note: Codes should be written in C programming language.
C++ LANGUAGE (FUNCTION)
C++ Programming Please
Chapter 2 Solutions
C++ Programming: From Problem Analysis to Program Design
Ch. 2 - 1. Mark the following statements as true or...Ch. 2 - Prob. 2MCCh. 2 - Which of the following is not a reserved word in...Ch. 2 - Prob. 4SACh. 2 - 5. Are the identifiers quizNo1 and quiznol the...Ch. 2 - 6. Evaluate the following expressions. (3,...Ch. 2 - If int x = 10;, int y = 7;, double z = 4.5;, and...Ch. 2 - Prob. 8CPCh. 2 - 9. Suppose that x, y, z, and w are int variables....Ch. 2 - Prob. 10SA
Ch. 2 - Which of the following are valid C++ assignment...Ch. 2 - Write C++ statements that accomplish the...Ch. 2 - Write each of the following as a C++ expression....Ch. 2 - Prob. 14SACh. 2 - Suppose x, y, and z are int variables and wandt...Ch. 2 - 16. Suppose x, y, and z are int variables and x =...Ch. 2 - Suppose a and b are int variables, c is a double...Ch. 2 - 18. Write C++ statements that accomplish the...Ch. 2 - Which of the following are correct C++ statements?...Ch. 2 - Give meaningful identifiers for the following...Ch. 2 - 21. Write C++ statements to do the following....Ch. 2 - Prob. 22SACh. 2 - The following program has syntax errors. Correct...Ch. 2 - Prob. 24SACh. 2 - Prob. 25SACh. 2 - Preprocessor directives begin with which of the...Ch. 2 - 27. Write equivalent compound statements if...Ch. 2 - 28. Write the following compound statements as...Ch. 2 - 29. Suppose a, b, and c are int variables and a =...Ch. 2 - Suppose a, b, and sum are int variables and c is a...Ch. 2 - Prob. 31SACh. 2 - Prob. 32SACh. 2 - Prob. 33SACh. 2 - Prob. 34SACh. 2 - 1. Write a program that produces the following...Ch. 2 - Prob. 2PECh. 2 - Prob. 3PECh. 2 - 4. Repeat Programming Exercise 3 by declaring...Ch. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - 7. Write a program that prompts the user to input...Ch. 2 - Prob. 8PECh. 2 - 9. Write a program that prompts the user to enter...Ch. 2 - 10. Write a program that prompts the user to input...Ch. 2 - 11. Write a program that prompts the capacity, in...Ch. 2 - 12. Write a C++ program that prompts the user to...Ch. 2 - 13. To make a profit, a local store marks up the...Ch. 2 - 14. (Hard drive storage capacity) If you buy a 40...Ch. 2 - 15. Write a program to implement and test the...Ch. 2 - 16. A milk carton can hold 3.78 liters of milk....Ch. 2 - 17. Redo Programming Exercise 16 so that the user...Ch. 2 - Prob. 18PECh. 2 - 19. Write a program that prompts the user to input...Ch. 2 - 20. For each used car a salesperson sells, the...Ch. 2 - 21. Newton's law states that the force, , between...Ch. 2 - 22. One metric ton is approximately 2,205 pounds....Ch. 2 - 23. Cindy uses the services of a brokerage firm to...Ch. 2 - 24. A piece of wire is to be bent in the form of a...Ch. 2 - 25. Repeat Programming Exercise 24, but the wire...Ch. 2 - 26. A room has one door, two windows, and a...Ch. 2 - Prob. 27PECh. 2 - 28. In an elementary school, a mixture of equal...Ch. 2 - 29. A contractor orders, say, 30 cubic yards of...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- (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_forwardC++ LANGUAGEarrow_forwardTask - Using pointers to process arrays (C Language) Example #5 below expected output is 45, but from the program below its coming out to 46. Please help make it come out to 45 as expected In a TV show, each minute can be either interesting or boring. Assume that if 7 consecutive minutes are boring, then an average viewer will stop watching the show. Write a C program that calculates how many minutes that an average viewer will watch a TV show, given the interesting minutes. Assume the TV shows are 45 minutes long. Requirements Name your program project4_minutes.c. Follow the format of the examples below. The program will read in the number of interesting minutes, then read in the interesting minutes. The program should include the following function. Do not modify the function prototype. int find_minute(int *minutes, int n); minutes represents the input array for interesting minutes, n is the length of the array (the number of interesting minutes). The function returns the how…arrow_forward
- C++ onlyarrow_forwardASSESSMENT TASK: Sample Selection Control Structure using Nested If condition The following question support the attainment of Course Intended Learning Outcomes (CILO): Design computing based solution using control structures, functions, array and other statements. INSTRUCTION: Read and study the assignment below. Solve the problem using C++ programming language, compile, run and screen shot the correct output. Copy and paste the source code or program code and the required sample output (screen shot) in the format below. The output should also display the school name, course name, student name, program, section, date and title of assessment task. PROBLEM: Write a program that will let the user to input year level and status base on table below. The output should be based on the possible combination of year level and status. GENDER AGE OUTPU INPUT OUTPUT INPUT For f Female 1 to 17 Minor M or m Male 18 to 59 Adult Other 60 and Invalid Senior input above Others Invalid //Sample if ,…arrow_forwardDeal or No Deal? Code in C languagearrow_forward
- C Programming Language (Code With C Programming Language) Problem Title : Visible Trees There is a legend about a magical park with N × N trees. The trees are positioned in a square grid with N rows (numbered from 1 to N from north to south) and N columns (numbered from 1 to N from west to east). The height (in metres) of each tree is an integer between 1 and N × N, inclusive. Magically, the height of all trees is unique. Bunga is standing on the northmost point of the park and wants to count the number of visible trees for each Column. Similarly, Lestari is standing on the westmost point of the park and wants to count the number of visible trees for each Row. A tree X is visible if all other trees in front of the tree X are shorter than the tree X. For example, let N = 3 and the height (in metres) of the trees are as follows6 1 87 5 32 9 4 On the first column, Bunga can see two trees, as the tree on the third row is obstructed by the other trees. On the second column, Bunga can see…arrow_forwardC++ Coding: ArraysTrue and False Code function definitions for eoNum() and output(): Both eoNum() and output() are recursive functions. output() stores the even/odd value in an array. Store 0 if the element in the data array is even and store 1 if the element in the data array is odd. eoNum() displays all the values in an array to the console.arrow_forwardStatic Variable: a variable whose lifetime is the lifetime of the program (static int x;) Dynamic Variable: It is a pointer to a variable (int *x;) Is this comparison true?arrow_forward
- help me create this c++ program please Requirements: The following programming structures must be evident in your source code. Conditional structure Looping structure Array Programmer-Defined Function (do not create a header file)arrow_forwardCode is must ---Below.arrow_forwardC language for solution Note: soution this program without use Struct 1. Write a program to do the following: a. Write a Cover Page function to print the HW details passing the needed parameters and has no return. b. Write a function that gets student grades and ID (maximum number of students is 20) then the function has a switch statement to enable the user to choose one of the following operation: i. Call MaxMin function to find and print the maximum and minimum grades as well as their ID ii. Call function Average to return the average grade of the class. iii. Call mark function to print students ID, their grades, and marks (as in the below table) iv. Call Sort function to sort the student ascending or descending based on their grades. The program will repeat the operation tile the user wish to terminate the program. Note: Student's grades are between 0 and 100 (use data validation technique). • You will get zero if you don't use comments and print HW details (your name, course name,…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr