Professional Documents
Culture Documents
Programming Activity 2 FINAL
Programming Activity 2 FINAL
Section:
Fundamentals of Programming
Activity 2
2nd Set
quantity sold item cost item selling price and cost profit
price difference
650 2.5 3.75 1.25 812.5
Algorithm:
1. enter the quantity sold, item cost, and item selling price
2. calculate the price and cost difference by subtracting the Item cost from
the item selling price
3. calculate the profit by multiplying the price and cost difference by the
quantity sold
4. display the profit
How would you modify the IPO chart and desk-check table to eliminate the use of
a processing items?
Input Processing Output
Algorithm:
1. enter the quantity sold, item cost, and item selling price
2. calculate the profit by subtracting the item cost from the item selling price
and then multiplying the result by the quantity sold
3. display the profit
Lab 2-3: Modify
Make the appropriate modifications to the IPO chart shown earlier in Figure 2-29.
INPUT PROCESS OUTPUT
doughnut price
muffin price
Algorithm:
1. enter number of doughnuts ordered, number of muffins ordered, doughnut
price, and muffin price
2. calculate the total doughnuts cost by multiplying doughnut price by number of
doughnuts ordered
3. calculate the total muffins cost by multiplying muffin price by number of muffins
ordered
4. calculate the total number of items ordered by adding together the number of
doughnuts ordered and the number of muffins ordered
5. calculate the total cost by adding the total doughnuts cost and the total muffins
cost.
6. display the total number of items ordered and total cost
For the first desk-check, use 4, 2, 0.50, and 0.55 as the number of doughnuts
ordered, number of muffins ordered, doughnut price, and muffin price,
respectively.
number of number doughnut muffin total total total total
doughnut of price price doughnut muffins number cost
s ordered muffins s cost cost of items
ordered ordered
Algorithm:
1. enter the shortbread sold, pecan sandies sold, and chocolate mint sold
2. calculate the total cookie sales by adding the shortbread sold, pecan sandies
sold, and the chocolate mint sold
3. calculate the shortbread contribution by dividing shortbread sold by total cookie
sales, and then multiply the result by 100
4. calculate the pecan sandies contribution by dividing pecan sandies sold by
total cookie sales, and then multiply the result by 100
5. calculate the chocolate mint contribution by dividing chocolate mint sold by
total cookie sales, and then multiply the result by 100
6. display the shortbread contribution, pecan sandies contribution, and chocolate
mint contribution
Lab 2-5: Desk-Check
Desk-check the algorithm twice. First, use $102.50 and $5.80 as the bill amount
and sales tax, respectively. Then, use $56.78 and $2.18.
1st Deck-Check
2nd Deck-Check
Algorithm:
1. enter first number, second number, and third number
2. calculate the sum by adding together the first number, second number, and
third number
3. calculate the average by dividing the sum by 3
4. display the average