{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS201 In Class Exercise-ch4 f2007 solution

# CS201 In Class Exercise-ch4 f2007 solution - Chapter 4(In...

This preview shows pages 1–2. Sign up to view the full content.

Chapter 4 (In class solution) //============================== Tracing #1 ============================= a. Young b. Young //============================== Tracing #2 ============================= a. Bingo!! b. Correct!! c. Bingo!! //============================== Tracing #3 ============================= a. Total is 37 b. Total is 4 c. Total is 37 //============================== Tracing #4 ============================= a. Orange 12 b. Peach 8 c. Apple 14 d. Peach 10 //============================== Program #1 ============================= int main() { const double TIPRATE = .15; double check, tip; cout << "Enter the check amount: "; cin >> check; tip = check * TIPRATE; if (tip <= 1.00) tip = 1.00; cout << "The tip amount is: \$" << tip << endl; return 0; } //============================== Program #2 ============================= int main() { string name; cout << " Who is the chairperson of the computer science department ? "; getline (cin, name); if (name == “Dr. Larry Dunning” || name == “Dr. L. Dunning” || name == “Dr. Dunning” ) cout << “Correct” << endl; else cout << “Nice Try” << endl; return 0; } //============================== Program #3 ============================= int main() { const double PERPOUND = .75; double weight, cost, amount, diff; cout << "Enter the weight: "; cin >> weight; cout << "Enter the amount tended: ";

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern