Write the pseudocode to print the bill depending upon the price and quantity of an item. Also print Bill GST, which is the bill after adding 5% of tax in the total bill.
Step 1: INPUT price Step 2: INPUT quantity Step 3: COMPUTE bill = price * quantity Step 4: COMPUTE GST = bill * 0.05 Step 5: COMPUTE Bill_GST = bill + GST Step 6: PRINT bill Step 7: PRINT Bill_GST
Alternatively:
INPUT price INPUT quantity COMPUTE bill = price * quantity COMPUTE GST = bill * 0.05 COMPUTE Bill_GST = bill + GST PRINT bill PRINT Bill_GST
Explanation
The question requires writing pseudocode to calculate the total bill from price and quantity, and then add 5% GST to get the final amount. Following the pseudocode format from Example 4.3 in the textbook, we use keywords like INPUT, COMPUTE, and PRINT. The calculation involves: (1) taking price and quantity as input, (2) computing the bill by multiplying price and quantity, (3) calculating GST as 5% of the bill, (4) computing Bill_GST by adding GST to the bill, and (5) printing both the original bill and the Bill_GST.
Solution Steps
Step 1: Accept price and quantity as INPUT
Step 2: COMPUTE bill = price × quantity
Step 3: COMPUTE GST = bill × 5/100 (or 0.05)
Step 4: COMPUTE Bill_GST = bill + GST
Step 5: PRINT bill and Bill_GST