QUESTION DESCRIPTION :
Write a program to display a grocery bill of the product purchased in the small market by John by getting following input from the user
Get the product name
Get the price of the product(Price per Unit)
Get the quantity of the product purchased
Input and Output Format:
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to output.
TEST CASE 1
INPUT
soap
33.00
2
OUTPUT
Product Details
soap
33.000000
2
Bill:66.00
EXPLANATION :
The code requires you to receive an input of Product Name , Product Price and the Quantity of the product bought and then print the Billing Details. ( Strings )
ALGORITHM :
Write a program to display a grocery bill of the product purchased in the small market by John by getting following input from the user
Get the product name
Get the price of the product(Price per Unit)
Get the quantity of the product purchased
Input and Output Format:
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to output.
TEST CASE 1
INPUT
soap
33.00
2
OUTPUT
Product Details
soap
33.000000
2
Bill:66.00
EXPLANATION :
The code requires you to receive an input of Product Name , Product Price and the Quantity of the product bought and then print the Billing Details. ( Strings )
ALGORITHM :
- Take a string as a char array to receive the name of the product ( ch[500] )
- Take two float variables and an integer variable to store bill amount, price of individual product and number of such products bought ( p , f , u )
- Receive the inputs for the respective categories from the user ( %s , %f , %d )
- Multiply the individual product price with the number of products bought and store it in the bill amount ( p=u*f )
- Print the result according to the required format.
No comments:
Post a Comment