Write code that will satisfy the following requirements. Assume each problem is independent of the others and that you will do separate inputs for each problem. It doesn’t really matter, as that what I’m interested in is the conditional processing for each problem. Answer as many as you can. Answer them on paper, or in one program. Use comments to label them in your program. (A-D 3 pts each, E-G 5 pts each, H 10 pts)
We will discuss how to turn in.
1) Input an integer value from a user. Assume a different input for A – G.
A– If that value is less than zero, output “error!”
B– If the value is greater than 1000 output, “That’s high.”
C– If the value is equal to the square root of 100, print “A perfect ten!”
D– If the value is equal to 7, output, “You’ve won the prize.”
E– Output, the square root of the number if the number is greater than 100, otherwise output the value cubed.
F– If the value is between 2 and 45, inclusive, output, “In the range”.
G– If the value is less or equal to five, output, “We think it’s too low”, otherwise if the value is odd output, “We’re sure”, otherwise output “We have no idea”.
H– The Firebird Software Support Company charges monthly for software support under three support levels. Level 1 costs clients $10 per hour of support, Level 2 costs $15.30 per hour, Level 3 costs $19.99 per hour, and Level 4 charges a flat rate of $2589 per month. Write a program that will input the level of support and the number of hours of support given for the current month. Output the support level, the number of hours and the correct monthly amount owed.
NOTE: Assume the user will enter valid values, so no need for data validation, nor need you worry about data format in the output.
2. Write a program that prompts the user to input a number. The program
should then output the number and a message saying whether the number is
positive, negative, or zero. (10 pts)
3) Explain the dynamics the short circuit mechanism involving the logical AND operator. How would such a mechanism be useful in the following code:
cin >> val;
if(val >= 0 && sqrt(val) > 10 )
cout << “A good value;
4) Write code that will fulfill the following flowchart (20 pts):
I will post picture for this question
please do this homework with too much details explaining why you answer it this way
1 day ago