Question: IF Statement - CH+ Program interade=95;if(grade>=94)coutic7icellent1; 1. What is the output of the program listed above? What would the program print if the value stored




IF Statement - CH+ Program interade=95;if(grade>=94)coutic7icellent1"; 1. What is the output of the program listed above? What would the program print if the value stored in the variable of grade was 90 ? Float originalPrice, salePrice; cout e -Enter the original cost of the itee: "; tin 3 originalPrice; cout "Enter the sale price: "; tin so saleprice; Int percentoff = static_cast(( originalprice - saleprice)/originalprice * 1e9); cout (loriqinatprice:- galeprice) foriglnalprice (100) z c. cout \( \$ " \)quot; ckoriginalprdce ce endl: c. cout k"percent oft: " k percentoff =$0 ) cout . Hou got a great salel" 3. Revise the program in \#2. If the pereent off is 50% or more print "Congratulations!" in addition to what is already printed. Use it second print statement to do this. Rewrite the code for the last part of the program that includes the if statement. 4. Revise the program in 12 so that it prints "Donel" when the program is complete - no matter what the pereent off is. How does the placement of this line of code differ from the placement of the code created for $3 ? 5. Enter and execute the C++ program above. a. Test the program at least three times. List the three test data you used and the corresponding output. Be sure you test each part of the condition. Explain why the data you chose were the best data to use to thoroughly test for the program. b. Now add another cout statement to the C+ + program above so that it prints "That's really hot!" when the water is 212 degrees or hotter. Rewrite the iffelse below with this statement included. Suppose you want to determine if a student is ready to graduate. The three criteria for graduation are that the student has eamed at least 120 eredits, their major GPA is at least 2.0 and their general GPA is also at least 20 . Which Boolean expression would be the correct test for C++ code? a. numCredits >=120 or majorGPA >=2.0 or averallGPA >=2.0 b. numCredits >120 and majorGPA >2.0 or overallGPA >2.0 c. numCredits >119 and majorGPA >=2.0 and overallGPA >2.0 d. numCredits >120 and majorGPA >=2.0 and overallGPA >=2.0 int numcredits; float majorGPA, overa11GPA; cout ee "Enter number of creatits: "]. cin 3 nuncredits; cout C "Enten GPA for the major: "; cin >s majorGPA; cout cc 'Emter overall CPA: "; cin overallGPA; If( Missing Boolcan expresion cout "Congratuations1" es end2: cout "You seom to neet all the critarda for erraduation"; ) 1=150 else i cout c -sornyl- c end1; 3 cout s You do not neet al1, the criteria fon ectduation, " es endi cout "oone. " rend; Enter and execute the program in #6. Include your choice for the correct Boolean expression. Create several sample data sets to test 10 different possibilities for the Boolean expression (There are 27 different combinations of possibilities). List the data you used to test these possibilities for the expression. Eech set of sample data should test a different combination of possibilities. Application Questions: Use Codio to check your work 1. Write the code for an if statement that adds 5 to the variable num if the value stored in the variable testA equals 25 . Otherwise subtract 5 from numl. 2. Write a C++ program that prompts the user for a word. If the word comes between the words apple and pear alphabetically, print a message that tells the user that the word is valid, otherwise, tell the user the word is out of ninge. 3. Write a C++ program that prompts the user for the cost of two items to be purchased. Then prompt the user for payment. If the amount entered is less than the total cost of the two items, print a message that states how much is still owed. Otherwise, print a thank you message and state how much change will be given. Write a C+ program that prompts the user for a multiple of 5 between I and 100 . Print a message telling the user whether the number they entered is vulid
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
