EXERCISES 3a Page 63-64;Exercises 4.1 1)-12.34 - float 2)"Hello" - string 3)"F" or 'F' - string or char 4)"1234" - string 5)'1' - char 6)"A" or 'A' - string or char 7)"Marcus" - string 3 (page 72)) a)int a,b; b)int b = 0; int a = b; c.int a = 0; float b = 3.5; d.char grade = 'A'; e.char c = 1; or char = '1'; Im not sure is the book is okay with keeping the value 1 or they want what 1 is referring to. f.int a, b, c, d, e , f; g.string x = "This is a test."; 4(page 122)) - I am solving these problems assuming the variables already have been pre defined somewhere in the program. a)y = 5*x+1; b)C++ does not solve equation by default. Its a polynomial. i dont think there is a way to rewrite it and have the computer read it without the help of a library c)x = 5*a+4; d.b = 0/-15; -------------------------------------------------------------------------- EXERCISES 3b Page 82,83 # 1-2 1) Display "Enter old wage: " Read Old_wage New_wage = Old_wage*1.06 Display Old_wage Display"+6%=" Display New_wage 2) Display "Enter assignment average:" Read Assignment_avg Display "Enter test 1:" Read Test 1 Display "Enter test 2:" Read Test2 Display "Enter test 3:" Read Test3 Display "Enter Final:" Read Final Test_avg = (Test1 + Test2 + Test3)/3 Class_score + Assignmnet_avg*.30 + Final*.25 + Test_avg*.45 Display "Final Score:" Display Class_score --------------------------------------------------------------------------------- EXERCISES 3c pages 83-84 #2-3 2) PROGRAM: #include #include using namespace std; using std::ios; int main() { char ascii = 67; cout << ascii << '\n'; ascii = 43; cout << ascii << '\n'; cout << ascii << '\n'; //return 0; } OUTPUT: C + + C:\Users\ansar\source\repos\OIT Brushup\Debug\OIT Brushup.exe (process 21044) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . . 3) PROGRAM: #include #include using namespace std; using std::ios; int main() { int age = 18; int daysInYears = 365; cout << age * daysInYears; } OUTPUT: 6570 C:\Users\ansar\source\repos\OIT Brushup\Debug\OIT Brushup.exe (process 12788) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . . =============================================================================== EXERCISE 4a Page 100 - #1 PROGRAM: #include #include using namespace std; using std::ios; int main() { float personTemp; cout << "Enter your temperature: " << endl; cin >> personTemp; cout.setf(ios::fixed); cout << setw(6) << setprecision(1) << personTemp << endl; } OUTPUT: Enter your temperature: 54.721 54.7 C:\Users\ansar\source\repos\OIT Brushup\Debug\OIT Brushup.exe (process 6536) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . . Page 123-124 #1-5 #include #include using namespace std; using std::ios; int main() { float a; a = 5 + 10 * 2; cout << a << endl; a = (5 + 10) * 2; cout << a << endl; a = 5; a = a + (5 + 10) * 2; cout << a << endl; a = 10 % 5; cout << a << endl; a = 10 % 3; cout << a << endl; } OUTPUT: 25 30 35 0 1 C:\Users\ansar\source\repos\OIT Brushup\Debug\OIT Brushup.exe (process 17632) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . . #5-7 #include #include using namespace std; using std::ios; int main() { float a; a = 7 + 5 - 2; cout << a << endl; a = 5.2 / 2.3; cout << a; } OUTPUT: 10 2.26087 C:\Users\ansar\source\repos\OIT Brushup\Debug\OIT Brushup.exe (process 21412) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . . -------------------------------------------------------------------------------------- EXERCISE 4b Page 112-114 PROGRAM: #include #include using namespace std; using std::ios; int main() { float money = 123.45; float raise; cout << "You have $"; cout << money << endl; cout << "enter percent raise: "; cin >> raise; raise = (raise / 100) + 1; money = money * raise; cout << "After your raise you have $"; cout << money << endl; } OUTPUT: You have $123.45 enter percent raise: 10 After your raise you have $135.795 C:\Users\ansar\source\repos\OIT Brushup\Debug\OIT Brushup.exe (process 18136) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . . Page 114 - 115 PROGRAM: #include using namespace std; int main() { double ProductionHours, PreProductionHours, ProducersHours, ProductionCost, PreProductionCost, ProducersCost, TotalCost, PRODUCTION_RATE, PRE_PRODUCTION_RATE, PRODUCERS_RATE; cout << "Enter Production Hours: "; cin >> ProductionHours; cout << "\nEnter Pre-Production Hours:"; cin >> PreProductionHours; cout << "\nEnter Producers Hours: "; cin >> ProducersHours; cout << "\nEnter Production Rate: "; cin >> PRODUCTION_RATE; cout << "\nEnter Pre Production Rate: "; cin >> PRE_PRODUCTION_RATE; cout << "\nEnter Producers Rate: "; cin >> PRODUCERS_RATE; ProductionCost = ProductionHours * PRODUCTION_RATE; PreProductionCost = PreProductionHours * PRE_PRODUCTION_RATE; ProducersCost = ProducersHours * PRODUCERS_RATE; TotalCost = ProductionCost + PreProductionCost + ProducersCost; cout << "\n\t\tCar Dealership Bill\n\""; cout << "\n\nProduction Cost: "; cout << ProductionCost; cout << "\n\nPre-Production Cost: "; cout << PreProductionCost; cout << "\n\nProducers Cost: "; cout << ProducersCost; cout << "\n\nWeekly Total Cost: "; cout << TotalCost << endl; return 0; } OUTPUT: Enter Production Hours: 5 Enter Pre-Production Hours:3 Enter Producers Hours: 7 Enter Production Rate: 8 Enter Pre Production Rate: 1 Enter Producers Rate: 6 Car Dealership Bill " Production Cost: 40 Pre-Production Cost: 3 Producers Cost: 42 Weekly Total Cost: 85 C:\Users\ansar\Source\Repos\cst116-lab2-rayyanansari03_1\Lab2Ansari\Debug\Lab2Ansari.exe (process 9804) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops. Press any key to close this window . . .