C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2.6, Problem 7E
(
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.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(Computer mini-project) Area of a unit circle equals rt. Cover a circle
with a 2 by 2 square and follow Algorithm 5.5 to estimate number Tt
based on 100, 1,000, and 10,000 random numbers. Compare results
with the exact value t = 3.14159265358... and comment on precision.
%3D
Please build an algorithm, test it and explain the results. Please
include code.
351 /5,000
(python)
Find at least 12 issues in the code.
A = int(input("Enter a number for A: "))
B = str(input("Enter a number for B: "))
C = int(input("Enter a number for C: "))
#Check that user input for A is not 0.
if A = 0:
print("Your coefficient for 'A' MUST BE a value greater than 0, otherwise your equation is not a quadratic!")
int(input(Please enter a new value for a:")) = A
import math:
//Compute the discriminant.
disc = (B*B) - (4*A*C)
#Display the disciminant computed.
print("\nThe discriminant of your equation is", str(disc) + ".")
#Check the sign of the computed discriminant
if disc == 0:
print("This equation has 1 real solution.")
x = (-B + math.sqrt(disc)) / (2 * A)
print("The solution to your equation is:", x)
elif disc > 0
print("This equation has 2 real solutions.")
x1 == (-B + math.sqrt(disc)) / (2 * A)
x2 == (-B - math.sqrt(disc)) / (2 * A)
print("One solution to your equation is:", x1)
print("The other solution to your equation…
(C++ OOP)
We have a house with 3 rooms.We need the user to enter 1 integer as the window number, 2 doubles as depth and width of the room, 1 double as the useless area, 1 boolean as the door's opening direction (e.g. 0 is outward).Program will compute and print the air condition as a string and the total useful area of the house as a double.
Calculating the air condition: Name it air_c. Divide the useful area by the window number. If air_c >20, output "bad". If air_c <11 output "good". If 11<=air_c<=20, output "ideal".
Attention: If the window number is 0, air condition is bad.
Calculating the useful area of room: Width*Depth-(useless area)if the door is inward;Width*Depth-(useless area)-0.8The worst air condition of the 3 is the final air condition of house.
---
1)The information about the home must be all private within a class.2)The class must get these inputs within constructor func.3)Calculating the useful area of a room must be done within a function of a class.4)Air…
Chapter 2 Solutions
C++ for Engineers and Scientists
Ch. 2.1 - (Practice) State whether the following are valid...Ch. 2.1 - Prob. 2ECh. 2.1 - Prob. 3ECh. 2.1 - (Practice) Determine names for functions that do...Ch. 2.1 - (Program) a. Using cout, write a C++ program that...Ch. 2.1 - (Program) a. Write a C++ program to display the...Ch. 2.1 - (Program) a. How many cout statements would you...Ch. 2.1 - (Program) a. Assuming your compiler isn’t case...Ch. 2.1 - (Practice) You’re given the task of wiring and...Ch. 2.1 - (Practice) You’re given the job of preparing a...
Ch. 2.1 - (Practice) You’re a sophomore in college and are...Ch. 2.1 - (Practice) You’re given the job of planting a...Ch. 2.1 - (Practice) You’re responsible for planning and...Ch. 2.1 - (Data processing) a. A national medical testing...Ch. 2.2 - (Debug) a. Will the following program work?...Ch. 2.2 - (Modify) Rewrite the following programs to conform...Ch. 2.2 - (For thought) a. When used in a message, the...Ch. 2.2 - (For thought) a. A token of a computer language is...Ch. 2.3 - (Practice) Determine data types appropriate for...Ch. 2.3 - (Practice) Compile and run Program 2.5.Ch. 2.3 - Prob. 3ECh. 2.3 - (Practice) Show how the name KINGSLEY is stored in...Ch. 2.3 - Prob. 5ECh. 2.3 - Prob. 6ECh. 2.3 - Prob. 7ECh. 2.3 - (For thought) Although you have concentrated on...Ch. 2.3 - (Practice) Although the total number of bytes...Ch. 2.4 - (Practice) For the following correct algebraic...Ch. 2.4 - (Practice) Determine the values of the following...Ch. 2.4 - (Practice) Determine the value of the following...Ch. 2.4 - (Practice) Evaluate the following mixed-mode...Ch. 2.4 - Prob. 5ECh. 2.4 - Prob. 6ECh. 2.4 - Prob. 7ECh. 2.4 - Prob. 8ECh. 2.4 - Prob. 9ECh. 2.4 - (Program) Write a C++ program that displays the...Ch. 2.4 - Prob. 11ECh. 2.5 - (Practice) State whether the following variable...Ch. 2.5 - Prob. 2ECh. 2.5 - (Practice) a. Write a declaration statement to...Ch. 2.5 - Prob. 4ECh. 2.5 - Prob. 5ECh. 2.5 - Prob. 6ECh. 2.5 - Prob. 7ECh. 2.5 - Prob. 8ECh. 2.5 - (Practice) a. Using Figure 2.14 and assuming the...Ch. 2.5 - Prob. 10ECh. 2.5 - Prob. 11ECh. 2.6 - (Modify) a. Modify Program 2.11 to calculate the...Ch. 2.6 - (Modify) a. Modify Program 2.11 to determine the...Ch. 2.6 - Prob. 3ECh. 2.6 - Prob. 4ECh. 2.6 - (Conversion) a. Design, write, compile, and run a...Ch. 2.6 - (Hydraulics) a. Write, compile, and run a C++...Ch. 2.6 - (Thermodynamics) a. Design, write, compile, and...Ch. 2.6 - Prob. 8ECh. 2 - (General math) a. Design, write, compile, and run...Ch. 2 - (General math) a. Design, write, compile, and run...Ch. 2 - (Physics) a. Design, write, compile, and run a C++...Ch. 2 - Prob. 4PPCh. 2 - (Hydraulics) a. Design, write, compile, and run a...Ch. 2 - Prob. 6PPCh. 2 - (Physics) a. The weight of an object on Earth is a...Ch. 2 - (Modify) a. Modify the program you wrote for...Ch. 2 - (Civil eng.) The maximum load that can be placed...Ch. 2 - (Civil eng.) Modify the program written for...Ch. 2 - (Mechanical eng.) The minimum radius required for...
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
- (Use Python) The function course_average should calculate and return the average of the three values pass to it. The function main should ask the user to enter three grades and then pass these values to the course_average function. This function should also display a message to the user in the format below. For example, if the user entered 100, 90 and 95 the message would be:The average of 100 , 90 and 95 is 95arrow_forward(C PROGRAMMING ONLY) 1. Dealing With Monthsby CodeChum Admin We're done dealing with days. It's time to step up and now deal with months! Instructions: In the code editor, you are provided with a code in the main() which has 12 printf's. Each printf prints a month with its corresponding value. For this program, January is 1, February is 2, March is 3, and so on. When you run the initial code, you will encounter errors because these month names that have been printed don't exist yet.Your task is to create an enum data type which contains these month names as values so that when we run the code, there will be no more error.Do not edit anything in the main(). Output January = 1February = 2March = 3April = 4May = 5June = 6July = 7August = 8September = 9October = 10November = 11December = 12arrow_forward(C++ Programming language) There are following two major issues associated with cpp programs:• When a program is terminated, the entire data is lost. • If you have to enter a large number of data, it will take a lot of time to enter them all in the different programs.Suggest a solution and elaborate the same with the help of suitable examples.arrow_forward
- (Prism Program) Write a program that can calculate the value of the surface area and volume of a Prism. The surface area of a rectangular prism is the total area of all six faces. When you have a cube, finding the area of one face allows you to find the total surface area of the solid very quickly, since it will be six times the area of one face. A = 2(width x length) + 2(length x height) + 2(height x width) Volume is the amount of 3-dimensional space an object occupies. Volume is measured in cubic units. To find the volume of a rectangular prism, we multiply the length of the prism by the width of the prism by the height of the prism. Volume of rectangular prism = length x width x height The input and Output of your program is as follows: Prism Mania! Prism Result! Valume uf a Rectangular Prm Length 55 Width 22 Volume (Cubic CM 56550 Height 55 Surface Area (CM) 10890 Exit Calculate Do It Again Input Outputarrow_forward(use Python)Write if/else code that adds one to the variable adults if the value of age is greater or equal to 18, and adds one to the variable minors otherwise. For example: Test Result adults=3 minors=3 age=18 adults = 4 minors = 3arrow_forward(Heat transfer) The energy radiated from the surface of the sun or a planet in the solar system can be calculated by using Stefan-Boltzmann's Law: E = o x T4 E is the energy radiated. o is Stefan-Boltzmann's constant (5.6697 x 10-8 watts/m2K4). Tis the surface temperature in degrees Kelvin (°K = °C + 273). a. Determine the units of E by calculating the units resulting from the right side of the formula. b. Determine the energy radiated from the sun's surface, given that the sun's average temperature is approximately 6000°K.arrow_forward
- (C PROGRAMMING ONLY!) Your task is to fill in the blank with the correct condition. 5. Finding the Impostorby CodeChum Admin There's this Dog game I played where a group of Dogs gather together and complete missions. One of them though is an impostor because it is not a real dog; its breed is not a dog breed. Your task is to find that impostor. To do this, you need to check Instructions: In the code editor, you are provided with the enum, DogBreed. Furthermore, an initial main() code is provided for you where the user is asked for what the breed of the Dog.Then, in lines 18 - 22, a partial code to check if the breed is valid or not is given.Your task is to fill in the blank with the correct condition. Make sure to use the values of the enum, DogBreed in checking. Input 1. Dog Breed Output Input the breed of the dog: 2Yup, the breed is validarrow_forward(C prog. language)arrow_forward(a) Using the program above, Compute a monthly tax (in Namibian Dollars) payableby an individual earning N$980, 953 per annum, with a tax free monthly allowanceof N$15, 000. NB: Your answer to this question should be presented as a commentat the end of the main code, with all details.arrow_forward
- (C PROGRAMMING ONLY!) 3. Pet Loverby CodeChum Admin One of the easiest ways to make a pet lover happy is to give them very many pets! My friend, Jhelian is a pet lover and for her 21st birthday, I'm planning to give her very many Dogs. It's very timely because my pet dog just gave birth to a lot of cuties! So I don't really need to buy. All I need is to just give these cute little fur babies to her. Instructions: In the code editor, you are provided with the definition of a struct Dog. This struct needs a character value for its gender, which could either be 'm' for a male Dog or 'f' for a female Dog.Furthermore, an array of Dogs has already been created an each of their genders has been set. Then, on line 16, a call to the function giveDogs() was made where the dogs array was passed.Your task is to implement this giveDogs() function which has the following details:Return type - voidName - giveDogsParametersa pointer/holder of a Dogs arraysize of the Dogs arrayDescription - loops…arrow_forward(Java) In which of these cases would it be good to use an enum ? Group of answer choices 1. You want a variable where there is flexibility to allow users to input an arbitrary string containing only a single word (i.e. no spaces). 2. You need to have a variable that encodes which day of the week it is. 3. You need to have a variable for a person’s birthday. 4. You need to output all possible integers between 1 and n, where n is input by the user.arrow_forward(Removing break and continue ) A criticism of the break statement and the continue statement is that each isunstructured. Actually, these statements can always be replaced by structured statements, although doing so can beawkward. Describe in general how you’d remove any break statement from a loop in a program and replace it with some structured equivalent. [Hint: The break statement exits a loop from the body of the loop. The other way to exit is by failing the loop-continuation test. Consider using in the loop-continuation test a second test that indicates “early exit because of a ‘break’ condition.”] Use the technique you develop here to remove thebreak statement from the application.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Boolean Algebra - Digital Logic and Logic Families - Industrial Electronics; Author: Ekeeda;https://www.youtube.com/watch?v=u7XnJos-_Hs;License: Standard YouTube License, CC-BY
Boolean Algebra 1 – The Laws of Boolean Algebra; Author: Computer Science;https://www.youtube.com/watch?v=EPJf4owqwdA;License: Standard Youtube License