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
Textbook Question
Chapter 2, Problem 24PE
A piece of wire is to be bent in the form of a rectangle to put around a picture frame. The length of the picture frame is 1.5 times the width. Write a
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
The screen size of a TV is given by the length of the rectangular diagonal.
Traditional TVs come in 4:3 ratio, that is, the ratio of length to width is 4 to 3. This means, if the length is x inches, then the width is (3/4)x.
LCD TVs come in 16:9 ratio.
Instructions
Write a program that:
Prompts the user to input the length of the diagonal (in inches) of the screen
Allows the user to select which type of TV the user would like to view the dimensions for
Ex.1: Traditional TV area. 2: LCD TV Area 3: Both types of TVs area
Have the program calculate and display the:
Screen length
Screen width
Screen area
for the specified type of TV.
A county collects property taxes on the assessment value of property, which is 60 percent of the property’s actual value. If an acre of land is valued at $10,000, its assessment value is $6,000. The property tax is then 75¢ for each $100 of the assessment value. The tax for the acre assessed at $6,000 will be $45. Write a program that asks for the actual value of a piece of property and displays the assessment value and property tax.
Procedure 2. Write a program that takes the x-y coordinates of a point in the Cartesian plane
and prints a message telling either an axis on which the point lies or the quadrant in which it is
found. If x or y is 0, the code will print out "The point is on x or y axis".
For example, if your input x is 2.5, and y is 1, it will print out "The point is in Quadrant One"; if
the input x is -2.3, and y is -3.2, it will print out "The point is in Quadrant Three"; if the input x
is 0, and y is 20, it will print out "The point is on x or y axis ".
Requirements:
1. The inputs of x and y should be float data type.
2. The input should prompt a message on the screen to ask for the input x and y.
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
- computer programingarrow_forwardWrite a program which takes an input from the user, if the input is 1, calculate the area of the rectangle, if the input is 2 calculate the area of square, if input is 3 calculate the area of the circle, if input is 4 calculate the area of the triangle, otherwise display "Wrong Input". A-arrow_forwardWrite a program that converts Celsius temperatures to Fahrenheit temperatures. The formula isarrow_forward
- Write a program that prompts the user to enter the month and first day of the month, and displays all the Sundays in that month. For example, if the user entered the month 7 for July, and the first day 4 for Wednesday, your program should display the following output:arrow_forwardUsing Python Write a program that displays all numbers from 1 to y that are divisible by x, where x and y are entered by the user:Example:if x = 3 and y = 30, the output is 3, 6, 9, 12, 15, 18, 21, 24, 27, 30arrow_forwardWrite a program that reads from the user a number that represents its grade, and then displays a message to tell the user if he passed the exam (if the entered grade is greater than or equal to 60) or not (if the entered grade is less than 60). The entered grade should be a number between 0 and 100. Otherwise, the program displays an error message. Sample Run: Please enter your grade (between 0 and 100): 75 Congratulations! You have passed the exam. Please enter your grade (between 0 and 100) : 45.5 Unfortunately... You have not passed the exam. Please enter your grade (between 0 and 100) : 112 ERROR: You have entered a wrong grade!arrow_forward
- Pretend that you have just opened a new savings account that earns 4 percent interest per year. The interest that you earn is paid at the end of the year and is added to the balance of the savings account. Write a program that begins by reading the amount of money deposited into the account from the user.Then your program should compute and display the amount in the savings account after 1, 2, and 3years. Display each amount so that it is rounded to 2 decimal places.arrow_forwardWrite a program that prompts the user: "How many degrees is it inside today? " and then starting at that number entered, displays the temperature (on its own line) as long as the current temperature is 75 degrees or higher. After displaying the current temperature, it should decrease by 1 degree. If it has decreased below 75 degrees, it should not show the temperature and should then display: "It is cool inside now, the AC is turning off. " followed by an endline. Complete the code within the brackets ({ }) below. i need the code in the C++arrow_forwardWrite a program that generates a random number in the range from 1 through 100 After generating the random number, the user is to guess the number. If the user’s guess is higher than the random number, the program should display “Too high, try again” If user’s guess is lower than the random number, the program should display “Too low, try again”. If the user guesses the number, the program should congratulate the user and then generate a NEW random number so the game can start over. Make the game menu driven with these options Main Menu ______________ 1)Play Game 2)Exit written in pythonarrow_forward
- • Write a program that prompts the user to input an integer and then outputs the number with the digits reversed. example, if the input is 12345, the output should be 54321. Your program must also output 5000 as 0005 and 980 as 089. Forarrow_forwardWrite a program that will ask the user to enter salary amount. And then compute for the TAX amount. If salary is 10,000 and below, the tax amount is 21% of the salary amount. if the salary is between 10,001 and 30,000, the tax amount is 28% of the salary amount. If the salary is more than 30,000, the tax is 31% of the salary amount. Then compute the net salary which is the Salary amount less tax amount. Display tax amount and net Salary.arrow_forwardWrite a Tip program that asks the user for the price (before tip) and outputs the final price (including tip). If price is less than 50 then tip is 15%, else tip is 18%. Calculate the total price including the tip. Then, practice by handwriting the code. Sample Run: Enter the price 45 The total price is 51.75 Enter the price 55 The total price is 64.9arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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 PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY