Page 1 of 1

Read the following code and answer the following question. 4#include 5 #include 6 using namespace s

Posted: Sun Jul 03, 2022 11:24 am
by answerhappygod
Read The Following Code And Answer The Following Question 4 Include Iostream 5 Include Iomanip 6 Using Namespace S 1
Read The Following Code And Answer The Following Question 4 Include Iostream 5 Include Iomanip 6 Using Namespace S 1 (288.6 KiB) Viewed 19 times
C++ COURSE PROGRAMMING LOGICcan anyone help me with the 6 questions to the buttom please ? this is C++ Programming logic course1. what rate will be assigned to the rate variable when the user enters the following codes 1, 2, 3, 4 and 5 ?
2. why is the directive on line 5 neccessary ?
3...4...5...6...
Read the following code and answer the following question. 4#include <iostream> 5 #include <iomanip> 6 using namespace std; 78 int main() 1 10 11 12 13 14 15 16 18 19 20 22 23 double sales - 0.0 double rate -0.0; char code - 2 cout << "Sales: ": cin >> sales; cout << "Code (1, 2, 3, or 4): ": cin >> code; if (code == '1' || code == '3') rate = 0.2- rate = 0.15; //end if //calculate and display the projected sales amount sales sales + sales* rate; cout << fixed << setprecision (2); cout << "Projected sales: "<< sales << endl; 26 return 0; 27] //end of main function. else 4 What rate will be assigned to the rate variable when the user enters the following codes: 1, 3, 2, 4, and 5? 2. Why is the directive on Line 5 necessary? 3. Why are the literal constants on Line 19 enclosed in single quotation marks? 4. How would you rewrite the if statement on Lines 19 through 23 to use the != operator in the condition? 5. How else could you write the statement on Line 26? 6. What changes would you need to make to the program so that it doesn't use the rate variable