Log on to Odin. Change to your 2010/2 folder. Name your program lab2a.cpp Follow along to write a program. Working with variables... 1. A variable x starts with the value 0. 2. A variable y starts with the value 5. 3. Add 1 to x. 4. Add 1 to y. 5. Add x and y, and store the result in y. 6. Display the value in y on the screen. What value did you get in y? 7. A variable i starts with the value 10. 8. A variable j starts with the value 2. 9. A variable k starts with the value 4. 10. Store the value of i times j in i. 11. Store the value of j times k in k. 12. Add i and k, and store the result in j. 13. Display the value in j on the screen. What value did you get in j? 14. A variable a starts with the value 1. 15. A variable b starts with the value 10. 16. A variable c starts with the value 100. 17. A variable x starts with the value 0. 18. Store the value of c times 3 in x. 19. Add the value of b times 6 to the value already in x. 20. Add the value of a times 5 to the value already in x. 21. Display the value in x on the screen. What value did you get in x?
----------------------------- Calculate a customer's credit ----------------------------- Name your program 2010/2/credit.cpp 1. Display the message --> Enter the customer's maximum credit. 2. Wait for the user to enter the customer's maximum credit. 3. Display the message --> Enter the amount of credit used by the customer. 4. Wait for the user to enter the customer's credit used. 5. Subtract the used credit from the max credit to get the customer's available credit. 6. Display a message that shows the customer's available credit. ------------------- Calculate sales tax ------------------- Name your program 2010/2/tax.cpp 1. Ask the user for these values: The retail price of an item being purchased The sales tax rate 2. Once these items have been entered, calculate and display: The sales tax for the purchase The total of the sale --------------------- Calculate golf scores --------------------- Name your program 2010/2/golf.cpp 1. Ask the user to enter the scores of 4 golfers in a tournament. Each golfer played 9 holes. Enter all the scores. 2. Add up the total for each golfer. 3. Display the final score of each golfer. 4. Allow the user to enter the scores like this: Enter the scores for player 1: 4 4 3 4 5 3 6 2 5 Enter the scores for player 2: 3 4 5 4 3 4 5 4 3 Enter the scores for player 3: 4 2 3 4 5 4 2 4 2 Enter the scores for player 4: 5 2 4 5 2 4 5 3 4 5. To run and test your program... Create a file in your directory named: 2010/2/golf_scores.txt Run your program like this: ./a.out < golf_scores.txt 6. The output will look something like this Final score of each golfer player 1: 36 player 2: 35 player 3: 30 player 4: 34