Tips: Use scanfO to take input from user. Use float/double type variables for th
ID: 3748879 • Letter: T
Question
Tips: Use scanfO to take input from user. Use float/double type variables for the problems that have floating point inputs or nsfpks Use as many variables as you want. Give proper comments at important steps of the codes. Problem 1. H-E-B Cash Counter (30 points) You are asked to write a program of a billing software for a specific cash counter of H-E-B. This counter can take only 2 different items with multiple quantities. At first, your program should ask the user to enter the price and quantity of the first item. This should be repeated for the second item. Then, the program should ask the user to enter any discount. Finally, the program should print the total bill with 8.25% sales tax included. Sample Input: (Your code should print the red texts on the screen. Black texts are sample user inputs) Enter Item#1 Price: $3.52 Enter Item#1 Quantity: 5 Enter Item#2 Price: $2.43 Enter Item#2 Quantity: 3 Enter Discount Amount: $5 Sample Output: Total Bill: $21.53Explanation / Answer
#include int main() { float p1, p2, discount; int q1, q2; printf("Enter Item#1 Price: $"); scanf("%f", &p1); printf("Enter Item#1 Quantity: $"); scanf("%d", &q1); printf("Enter Item#2 Price: $"); scanf("%f", &p2); printf("Enter Item#2 Quantity: $"); scanf("%d", &q2); float total = p1*q1 + p2*q2; printf("Enter Discount Amount: $"); scanf("%f", &discount); printf("Total Bill: $%.2f ", (total - discount)*1.0825); return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.