Write a program that reads in the description and amount for 3 items purchased by a customer (you can assume that the customer is buying 1 of each item). The program must calculate the total, then determine the discount amount (at 5% discount) and the amount after discount. Furthermore, the store provides a “loyalty point” for each R5 spend (before discount). The final slip must have the following structure (including the blank lines as shown). The 3 item amounts have no currency sign, is aligned on the right and displays 2 decimal places. Below the list of items, the total, discount and final amounts must show the currency sign.
To create this specific output, the memo uses an item column width of 17 characters and an amount column width of 7 characters for the list of the 3 items. You do not need to use the same values, but you can use it as guidance. You can also use spaces and the \t escape sequence or a combination of different plans for alignment.
Comments
Leave a comment