Question: This practice problem will have you working with formatting and lists to print out a formatted receipt given the details of a transaction. You will
This practice problem will have you working with formatting and lists to print out a formatted receipt given the details of a transaction.
You will ask the user for how many different items they have purchased Note: this is referring to different item numbers and not the quantities of each item. and then gather the appropriate information for each item to print out a receipt.
You will need to gather the order date, customer number and customer name and print this formatted information out for the header of the receipt. This should be printed after all of the item order information has been gathered!
The first four input prompts should be as follows for the number of items ordered, the order date, the customer number and the customer name:
'How many items are being ordered? 'Enter the order date: 'Enter the customer number: 'Enter the customer name:
Before printing out anything for the receipts, you will need to gather all of the information to be printed. Think of different ways to store this data.
Hint: A list of lists where each inner list contains all of the information or parallel lists would each work for this!
For each different item ordered, you will need to gather the following:
item number
item description
request date
quantity
price
total
The prompts for the above are as follows:
'Enter the item number: 'Enter the item description: 'Enter the request date: 'Enter the quantity: 'Enter the item price: 'Enter the total price:
Note: The price should be printed formatted to decimal places along with the item total.
Make sure to keep track of the overall order total as well for the final receipts total. This should also be formatted to decimal places.
With all of the data gathered, use string formatting to output a formatted receipt for the transaction.
The formatting should go as follows:
Output the string Order Date: followed by the order date right aligned spaces.
Output Customer:" followed by the customer number right aligned spaces and then the customer name right aligned spaces.
Output a blank line.
Output the following string this can be copied exactly: Ln# Item # Item Description Req Date Qty Price Total
Then, loop through the data that was stored earlier and print the following for each item type ordered this should all be on the same line!:
The current line number center aligned spaces.
spaces
the item number left aligned spaces
the item description left aligned spaces
the request date center aligned spaces
the quantity right aligned spaces
the price right aligned spaces with decimals.
a string dollar sign right aligned spaces. $
the items total price right aligned spaces with decimals.
Finally, once all of the items have been printed, output a blank line followed by a line consisting of spaces, the string Overall Total and the overall total price right aligned spaces with decimal places.
The following example output should be to help visualize the final output. Note: the column numbering is to assist you with lining up output and should not be part of your actual output.
Example. If the inputs are:
Costanza, George Louis BC Laser printer paper K Pencils
The output should be:
Order Date: Customer: Costanza, George Louis Ln# Item # Item Description Req Date Qty Price Total BC Laser printer paper $ K Pencils $ Ov
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
