C Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9780357238547
Author: D. S. Malik
Publisher: Cengage Limited
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 2, Problem 27PE
Program Plan Intro
Implementation of a program to compute the amount of paint required to paint the walls of a room
Program Plan:
Write a C++ program with a main function and the required set of statements to accomplish the following:
Prompts user for the dimensions of door, windows, bookshelf and walls of a room, and the paint capacity
Computes the net paintable area of the room and the amount of paint required to paint the walls
Prints the result
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Make use of the functions glPolygonMode() and glCullFace() to write a program that can display the front face and back face of a square alternately:
It displays the front face in red.
When clicking the mouse at the square, it displays the back face in green.
When clicked again at the square, it displays the front face again, and so on.
in C++ Language can you answer that question
Do not use regular expressions in your solution for this exercise. Write a program that checks to see if an input password is valid or not. In this exercise, a valid password has the following characteristics:
It contains at least eight characters.
It contains at most 12 characters.
It contains only alphabetic characters, digits and the underscore (‘_’) character.
It does not start with a digit.
It has a mix of upper-case and lower-case characters.
Your class must contain the following method: public static String checkPassword(String input)
This method receives a possible password as input and returns only the String“OK” if the password is valid. If the password is not valid then you can return the reason(s) for that as the return value. This is not a part of the requirements, however, and you don’t need to do that. You can simply return null for an invalid password.
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
- Part 4: For circle, square and annulus write a program to find the area, perimeter (or circumference) for a range of parametric values given by the user and plot the corresponding shapes in the range given. User needs to identify lower and upper values of each parameter. The identified range for the parameters should be then divided into 10 monotonic steps inside your program. Accordingly, you need to calculate the values and plot the shapes corresponding to all 10 values in the range identified by the user. The program should plot the geometries in the first quadrant.arrow_forwardPLEASE CODE IN PYTHON The Penny Pitch game is popular in amusement parks. Pennies are tossed onto a board that has certain areas marked with different prizes. For example: The prizes available on this board are puzzle, game, ball, poster, and doll. At the end of the game, if all of the squares that say BALL are covered by a penny, the player gets the ball. This is also true for the other prizes. The board is made up of 25 squares (5 x 5). Each prize appears on three randomly chosen squares so that 15 squares contain prizes.In Python, create a PennyPitch application that displays a Penny Pitch board (use [ and ] to indicate squares) with prizes randomly placed and then simulates ten pennies being randomly pitched onto the board. After the pennies have been pitched, the application should display a message indicating which prizes have been won, if any.arrow_forwardWhat is the difference between static and dynamic type checking? Static type checking occurs at compile-time, while dynamic type checking occurs at runtime. ○ Static type checking is faster than dynamic type checking. Dynamic type checking ensures that the program will not crash. Static type checking allows types to change during execution.arrow_forward
- Please help me with this C++ code. Please show work and code output. Write a class definition that stores information for a book. I want to store the following information about this book.arrow_forwardProgram 1: Write a program that asks the user to input a sentence and then outputs the sentence back with the case of every character reversed. So for example: “CaTs RuLe!” would be given back as “cAtS rUlE!” . Spaces and punctuation should be left in place. You can use the Character class static functions to test the case of each letter. You do not need to place any code in static methods (besides the main method), you do not need to worry about try/catch blocks, and you do not need to make the program run more than once. in javaarrow_forwardC++ The restaurant owner wants to give those attending a specific dish, but the method yields a lot more food than what he can give. Because of this, the kitchen staff is interested in creating a meal with fewer ingredients but with identical ingredient ratios. Yet, the cook dislikes fractions. The cook desires that the decreased method also include just whole numbers of items since the earlier method only called for entire numbers. Assist the cook in deciding the quantity of each ingredient to use to produce the least amount of food. Input 3 244 3234 43 1596 Output 11 234 1532arrow_forward
- C++ we have a function called send email and send email is going to send an email. It's not going to return anything. It just does the action of sending an email and by sending an email, they really mean print to the console. So we're going to Write Right. Our function. It has three input parameters. The name. And we should include string. It has the prize. And it has a Boolean. So those are the three pieces. That's the function prototype if I copy this. I'm not going to write the whole thing and we'll see the problem that exists with the testing that will be fixed.arrow_forwardin C# Sometimes figuring letter grades is hard. Write a program that asks for, and reads from the user, a midterm exam grade and a final exam grade. Compute the average of those two grades and ouput a letter grade based on the scale shown below. CHALLENGE PROBLEM: One of my graduate school classes modified the above calculation. This professor said that the final grade would be determined by the simple average of the midterm and the final, however, if the student scored better on the final than they did on the midterm, the professor would weight the midterm exam at 25%, and the final exam at 75% when computing the final grade. Modify your code to use this professors modification in determining letter grade. Here is the grading scale:arrow_forwardExamples Input 8 Output How about visiting Gibraltar Rock? It is about 8 miles away. Input 30 Output How about visiting Oxnard? It is about 30 miles away. Input 120 Output You provided an invalid distance that is not between 0 and 100 miles. Input -100 Output You provided an invalid distance that is not between 0 and 100 miles. Hints • you can check the type of an input parameter by using the type () function.arrow_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 Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning