Chapter 3: Problem 36
include
Chapter 3: Problem 36
include
All the tools & learning materials you need for study success - in one app.
Get started for freeWrite a pseudocode algorithm for a program that calculates the total of a retail sale. The program should ask for the amount of the sale and the sales tax rate. The sales tax rate should be entered as a floating-point number. For example, if the sales tax rate is 6 percent, the user should enter \(0.06 .\) The program should display the amount of sales tax and the total of the sale. After you write the pseudocode algorithm, convert it to a complete \(\mathrm{C}_{++}\) program.
Assume that the following variables are defined: int age; double pay; char section; Write a single cin statement that will read input into each of these variables.
Write \(\mathrm{C}++\) expressions for the following algebraic expressions: \\[ \begin{array}{l} a=12 x \\ z=5 x+14 y+6 k \\ y=x^{4} \\ g=\frac{b+12}{4 k} \\ c=\frac{a^{3}}{b^{2} k^{4}} \end{array} \\]
Assume a program has the following variable definitions: int units; float mass; double weight; and the following statement: weight = mass * units; Which automatic data type conversion will take place? A) mass is demoted to an int, units remains an int, and the result of mass * units is an int. B) units is promoted to a float, mass remains a float, and the result of mass * units is a float. C) units is promoted to a float, mass remains a float, and the result of mass * units is a double.
Assume the array name is defined as follows: char name[25]; A) Using a stream manipulator, write a cin statement that will read a string into name, but will read no more characters than name can hold. B) Using the getline member function, write a cin statement that will read a string into name, but will read no more characters than name can hold.
What do you think about this solution?
We value your feedback to improve our textbook solutions.