(a)
To write a statement if an angle is equal to 90 degree, print the message “The angle is a right angle”; else, print the message “The angle is not a right angle.”.
(b)
To write a statement if temperature is above 100 degrees, display the message “above the boiling point of water”; else, display the message “below the boiling point of water.”.
(c)
To write a statement if number is positive, add number to variable positivesum; else, add the number to the variable nagtivesum.
(d)
To write a statement if the slope is less than 0.5, set the variable flag to 0; else, set flag to 1.
(e)
To write a statement if the difference between volts1 and volts2 is less than 0.001, set the variable approx to 0; else, calculate approx. as quantitity (volts1 − volts2) / 2.0.
(f)
To write a statement if frequency is above 60, print the message “The frequency is too high.”;
(g)
To write a statement if defferece between temp1 and temp2 exceeds 2.3, calculate the variable error as (temp1 − temp2) * factor.
(h)
To write a statement if x is greater than y and z is less than 20, request that the user to input a value for the variable p.
(i)
To write a statement if distance is greater than 35, request that the user input a value for the variable time.
Trending nowThis is a popular solution!
Chapter 4 Solutions
C++ for Engineers and Scientists
- 1. Write suitable if statements for the following conditions: a. If an angle is equal to 90 degrees, print the message "The angle is a right angle."; else, print the message "The angle is not a right angle." b. If the temperature is above 100 degrees, display the message "above the boiling point of water"; else, display the message "below the boiling point of water." c. If the number is positive, add the number to the variable positivesum; else, add the number to the variable negativesum. d. If the slope is less than 0.5, set the variable flag to 0; else, set flag to 1. e. If the difference between slopel and slope2 is less than 0.001, set the variable approx to 0; else, calculate approx as the quantity (slopelf-fslope2)f/f2.0. f. If the frequency is above 60, display the message "The frequency is too high." g. If the difference between templ and temp2 exceeds 2.3, calculate the variable error as (templf-ftemp2)f*ffactor. h. If x is greater than y and z is less than 20, request that…arrow_forwardQuestion 1 (5% - 3 minutes) Assume that a Person is defined as shown here and that two variables are defined as follows: Person a, b; typedef struct p { char *name; unsigned char age: height: *friend; double struct p }Person; Complete the whole test based on this Person struct and variables a and b.arrow_forward1. 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_forward
- Computer Programmingl: Homework 4 Q1.Write suitable if statements for the following conditions: a) If the number is positive, add the number to the variable positivesum; else, add the number to the variable negativesum. b) If the slope is less than 0.5, set the variable flag to 0; else, set flag to I.arrow_forwardа. (1 =5) d. a, b, and c are all wrong 4) Which of the following is not a valid boolean expression.arrow_forwardPython (Do following way) # We same a name is short if it is 3 characters or fewer. Ask the user for# their name with the prompt 'Enter your name: '# If the len() of the user' name is less than 4, print the user's name,# followed by 'is a short name'# Otherwise, print the user's name, followed by 'is not a short name' # DO NOT USE TWO IF STATEMENTS. Use an if + else. If you use two if statements# I will deduct points even if your code passes the tests. # For example:# Enter your name: PB# pb is a short name # Another example:# Enter your name: Lamio# Lamio is not a short namearrow_forward
- (Using Python)Write program to ask user to enter number and assign to variable points. Write an if-else statement that determines whether the points variable is outside the range of 17 to 81. If the variable’s value is outside this range it should display “Invalid points”, otherwise ,It should display “Valid points”arrow_forwardState whether the following are true or false. If the answer is false, explain why.c) The expression (x > y && a < b) is true if either x > y is true or a < b is true.arrow_forward(PYTHON) 3. Create an if statement that checks to see if the number x is greater than 0 and less than or equal to 50.arrow_forward
- (a) Write a Boolean expression for |x 5| 4.5.arrow_forward{Only using C language} ( Code C) Rules programs: You have to solve using 1.if else / switch 2. while / for Please, quickly, I have a specific time to answer The program shall be solved either by using if else ladder or switch only. No marks will be awarded if the problem is solved using any other technique. Problem: Read your name and one numeric value [Omani Rial], print the following menu as shown in below output, read user choice. Find and print equivalent currency value. Formulas: 1 Omani Rial = 2.60 US Dollars 1 Omani Rial = 2.18 Euros 1 Omani Rial = 1.86 British pounds 1 Omani Rial = 9.55 UAE Dirhamsarrow_forward% Trapezoidal Method function[trap]=trap_method(x,y) if length(x)~=length(y) error('Vectors must be of equal length') end i=1; while iarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr