Lesson – Students will be reviewing loops (we have studied these loops – this is just a review for them).
a. Go to: http://www.learn-programming.za.net/programming_java_learn04.html
b. This site pretty much sums up what we have covered in a very brief format.
c. NOTE: In case this site can't be accessed from school, the teacher will have notes to review with you BUT it's your responsibility to make sure you study this information prior to Thursday as THERE IS A QUIZ ON THIS INFORMATION on Thursday, 12/3/09
e. Take HANDWRITTEN NOTES on loops and take these handwritten notes homes to study from – DO NOT COLLECT but make sure they have completed them.
What is a loop?
For Loop?
Incrementing/Decrementing
Code within a loop
While Loop
Do While Loop
When done the handwritten notes, the students will write a program with the following specs. You can write this on the board.
Program Name: Purchase
i. Students will write a program (using a loop) that will ask the user to enter the item name and purchase price.
ii. Each time the user enters a new item, the output will change reflecting what item was just added along with the total price with 6% sales tax.
iii. For example:
Program will ask user: Please enter a brief description of item purchase:
User will enter something like: Necklace
Program: What is the cost of this item?
User: 10.00
Program: How many of these items would you like?
User: 2
Program: You are purchasing:
2 Necklace @ 10.00 each
Total of this purchase with 6% sales tax: $21.20
Would you like to enter another item?
[if user enters no, the following will display]:
Your total bill for these purchases is $21.20.
Thank you come again!
[Department Store Name – students can create their own with their own name incorporated into it]
[if user enters yes, the program will run the loop again:
Program will ask user: Please enter a brief description of item purchase:
User will enter something like: Earrings
Program: What is the cost of this item?
User: 20.00
Program: How many of these items would you like?
User: 1
Program: You are purchasing:
1 Earrings @ 20.00 each
Total of this purchase with 6% sales tax: $21.20
Your total purchase at this point is: $42.40
(point out to students how this accumulates)
Would you like to enter another item?
The program will continue…..