PT1420 Unit 3 Assignment 1

PT1420 Unit 3 Assignment 1


PT1420 Intro to Programming

PT 1420 Unit 3 Assignment 1 Homework:
3. Write assignment statements that perform the following operations with variables a, b and c.
a. set b = a+2
b. set a = b*4
c. set b = a/3.14
d. set a= b-8
5. Write a pseudo code statement that declares the variable cost so that so that it can hold real numbers.
a. declare real cost
6. Write a pseudo code statement that declares the variable total so that it can hold integers. Initialize the variable with value zero.
a. Declare real price = 0.00
display “the original price”
input items original price
display “price”
7. Write a pseudo code statement that assigns the value 27 to the variable count.
A count: = 27
8. Write pseudo code statement that assigns the sum of 10 and 14 to the variable total.
a. declare integer total
set total = 10+14
display total
9. Write a pseudo code statement that subtracts the variable down payment from the variable total and assigns the result for the variable due.
a. declare integer down payment
declare integer total
declare integer due
set due = total – down payment
display “down payment “
input down payment
10. Write a pseudo code statement that multiplies the variable subtotal by 0.15 and assigns the result to the variable total fee
a. declare real subtotal
declare real totalfee
set totalfee subtotal * 0.15
display “subtotal”
input subtotal
display totalfee
4. Assume the variable result, w,x,y, and z are all integers, and that w=5, x= 4, y= 8, and z= 2.What value will be stored in result in each of the following statements?
a. set result = 12
b. set result = 4
c. set result = 2
d. set result = 6
PROGRAMMING EXERCISE
6. Sales Tax
Design a program that will ask the user to enter the amount of purchase. The program should then compute the state and county sales tax, Assume the state sales tax is 4 percent and the county sales tax is 2 percent. The program should display the amount of...

Similar Essays