Concept explainers
If originally
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
- Help with C langauge codingarrow_forwardIf the following code segment compiles correctly, what do you know about the variable x? if(x) WriteLine(OK); a. x is an integer variable. b. x is a Boolean variable. c. x is greater than 0. d. none of thesearrow_forwardWhat is the value of each of the following Boolean expressions? 54 3=3 2+45 6==7 2+4=6 3+4==4+3 1!=2 2!=2 5==72 3+9=0arrow_forward
- (Statistics) This is the formula for the standard normal deviate, z, used in statistical applications: z=(X)/ X is a single value. refers to an average value. refers to a standard deviation. Using this formula, you need to write a program that calculates and displays the value of the standard normal deviate when X=85.3,=80,and=4. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items. d. Test the formula written for Exercise 7c, using the data given in the problem.arrow_forwardWhen you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)arrow_forwardWelcome to the temperature conversion program. Please enter a the sample temperature in Degrees Kelvin:> 345Do you wish to convert the temperature to (c) for Celsius, or (f) for Fahrenheit:>cThe water is in a liquid state at 72.0 degrees celsius. Do you wish to enter another temperature? (Y for yes, N for no):> y Please enter a the sample temperature in Degrees Kelvin:> 234Do you wish to convert the temperature to (c) for Celsius, or (f) for Fahrenheit:>FThe water is in a solid state at -38.2 degrees fahrenheit. Do you wish to enter another temperature? (Y for yes, N for no):> Step 1 Convert kelvin into Celsius KelvinTemp − 273.15 = -273.1°C Convert kelvin into Fahrenheit FaherenheitTemp = (kelvinTemp- 273.15) * (9/5) + 32) Phases based on the temperature in Liquid, Solid, and Gaseous state state celsiusTemp FahreheitTemp gas(water vapor) >100 degree > 212 degree solid <0 degree <32 degree liquid other temperature other temperatures…arrow_forward
- H.W4: If INTEGER variables i and j have values 7 and 2, and REAL variables a and b have values 4.5 and 2.0, respectively, what is the result of Mod(i, j) Va. b min(a, b) + 2. a. barrow_forwardIn C++ (Algebra: solve 2 × 2 linear equations) You can use Cramer’s rule to solve the following 2 × 2 system of linear equation: ax + by = ecx + dy = fx = (ed - bf) / (ad - bc)y = (af - ec) / (ad - bc) Write a program that prompts the user to enter a, b, c, d, e and f and displays the result. If ad - bc is 0, report that “The equation has no solution”. Sample Run 1 Enter a, b, c, d, e, f: 9.0 4.0 3.0 -5.0 -6.0 -21.0 x is -2 and y is 3 Sample Run 2 Enter a, b, c, d, e, f: 1.0 2.0 2.0 4.0 4.0 5.0 The equation has no solutionarrow_forwardQ4:- write a program in c++ language to read the height of cylinder then calculate the volume and the side area of cylinder in the case that the height of all cylinders is greater than or equal to 7 cm according to these rules: i. Volume height the base area ii. Side area = height the base perimeter Suppose the number of cylinders is 500arrow_forward
- 1. Supposed a ball is thrown straight up in the air with an initial velocity of 50 feet per second and an initial height of 5 feet. How high will the ball be after 3 seconds? Note: The height after t seconds is given by the expression - 16t+vot+ho, where ve is the initial velocity and he is the initial height.arrow_forwardQuestion 1 Simplify the following expression using tabulation method ONLY: F(A,B,C) = ABC' + AB'C' + AB'C + ABC' + ABCarrow_forwardThe correct statements are: (ab)*a = a(ba)* (a U b)* b (a U b)* = a*b (a U b)* (a U b)* ba (a U b)* U a*b* = (a U b)* □ (a U b)* b (a U b)* U (a U b)* a (a U b)* = (a U b)*arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr