Chapter 6 IM Answers

Chapter 6 IM Answers - An Introduction to Programming with...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
An Introduction to Programming with C++: Fifth Edition 978-1-4188-3618-4 Chapter 6 Answers CONCEPT LESSON REVIEW QUESTIONS 1. c 180 2. d 3000 3. b 200 4. c Mark 5. b Jerry 6. c Mark 7. d Sue 8. d switch 9. a diamond 10. b case ‘3’: 11. c Mark 12. d Sue 13. b Jerry EXERCISES – PENCIL AND PAPER 1. if (quantity == 10) cout << “Equal” << endl; else if (quantity > 10) cout << “Over 10” << endl; else cout << “Not over 10” << endl; //end ifs 2. cout << “Enter the code: ”; cin >> code; cout << “Enter the sales: ”; cin >> sales; if (code == 1 || code == 2) cout << sales * .12 << endl; else if (code == 3) cout << sales * .15 << endl; else if (code == 4) cout << sales * .20 << endl; else cout << “Error” << endl; //end ifs 3. cout << “Enter the code: ”; cin >> code; cout << “Enter the sales: ”; cin >> sales; switch (code) { case 1: cout << sales * .02 << endl; break; case 2: case 3: case 4: cout << sales * .05 << endl; break; case 5: cout << sales * .1 << endl;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
break; case 6: case 7: cout << sales * .15 << endl; break; default: cout << “Error” << endl; } //end switch 4. switch (stateId) { case 1: state = “Alabama”; capital = “Montgomery”; break; case 2: state = “Arizona”; capital = “Phoenix”; break; case 3: state = “Illinois”; capital = “Springfield”; break; case 4: state = “Oregon”; capital = “Salem”; } //end switch EXERCISES – COMPUTER 1. See the Cpp5\Chap06\Ch6ConE01 Solution-IM files. 2. See the Cpp5\Chap06\Ch6ConE02 Solution-IM files. 3. See the Cpp5\Chap06\Ch6ConE03 Solution-IM files. 4. See the Cpp5\Chap06\Ch6ConE04 Solution-IM files. 5. See the Cpp5\Chap06\Ch6ConE05 Solution-IM files. 6. See the Cpp5\Chap06\Ch6ConE06 Solution-IM files. 7.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

Chapter 6 IM Answers - An Introduction to Programming with...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online