CMPS-2010 Lab-2

Get started
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?

Part 2 - Write these programs yourself
-----------------------------
Calculate a customer's credit
-----------------------------
Name your program lab2b.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 lab2c.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


----------------------------------
Current balance in savings account
----------------------------------
Name your program lab2d.cpp

1. Ask the user for these values:
   The starting balance
   The total dollar amount of depostis made
   The total dollar amount of withdrawals made
   The monthly interest rate

2. Display the current balance on the screen.