Class Work for Feb. 17-20, 2009
Please work through these assignments in order. On Wednesday and Friday you will be taking some short quizzes.
Calculator Assignment (This will replace several of the calculator programs from previouis labs).
Calculator - 20 points
- Project name: yourname_calc
- cpp file name: yourname_calc
- Using the pseudocode we wrote last week, write the part of the program that
will allow the user to input two numbers. Add some cout messages to verify
the input back to the screen.
- Add a section that will ask the user whether they want to add, multiply,
divide, or subtract. You should add a character variable (char) to hold this
value. The user could enter a math symbol (+, -, *, /) or you can ask then
to enter A for add, S for subtract, D for divide, or M for multiply)
- Display the user's choice of operator back to the screen.
- Based on the user's selection for a mathematical operator, create if loops that will calculate the correct operation, and display the user's answer back to the screen. (Hint: You'll need four different if loops
- Think about your program formatting -- indenting, white space, following the standards we have talked about in class for placing brackets, etc.
- Your calculator will be graded according to this sheet.
When you have finished your calculator, begin the following work:
- In the C++ book, read p. 231-237 (starting at "for Looping (Repetition) Structure
- Study the code examples included on these pages -- don't just skim them
- Watch the "For Loop PPT" screencast movie
- Watch For Loop Ex. #1 screencast
- Do Lab 4-1
- Watch For Loop Ex #2 -- helps you with common problems
- Try the Practice problems -- create short programs to test each of these loops. Print the final code with a handwritten explanation of what is happening (or not happening) with each loop
- Watch For Loop Ex #3
- Do Lab 4-2, 4-3 and 4-4
Revew the logical operators example (included in Lab 3, or also in Lab 4)
- Do Lab 4-5
- Study programming Example on p. 237-241 of the text
- Do Lab 4-6
When you finish Lab 4-6, do the Enrichment Problems at the end of Lab 4. If you are finished before I return, these are a REQUIRED use of your time.
Watch For Loop Ex #3