Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help pleaSe Output example Existing code 2. Carefully review the Part-2 Output Example (next section) to see how the program is expected to work 3.

image text in transcribed

help pleaSe

Output example

image text in transcribed

image text in transcribed

Existing code

image text in transcribed

image text in transcribed

2. Carefully review the "Part-2 Output Example" (next section) to see how the program is expected to work 3. You will need to modify the code as required to produce a solution to work as demonstrated in the sample output. 4. Displaying the sales data in a tabular format requires the application of some slightly more advanced formatting features (you will learn more about this later in the semester). For now, you can use the first data line below to get you going (copy/paste into your code), and complete the printf statement accordingly: printf("Patty %-40 %5.21f %30 %9.41f %9.41f %9.41f ", ... Similarly, the totals row for the above table also requires some more advanced formatting. Use the following printf statement and complete it accordingly: printf("%33.41f %9.41f %9.41f ",... 5. In a tabular format, show how the daily total retail sales would be broken down by coin denominations if it were to be converted to only coins (start from the largest denomination working down to the smallest). To accomplish this, you will need to apply integer division (/) to obtain the number of coins for a given denomination, followed by an application of the modulus operator (%) to obtain the new remaining amount (to be used in the next coin calculation) Note lo The first table is based on the sub-total and excludes taxes The second table is based on the total and includes taxes o 6. The first data row shows only the starting balance, followed by the coin denominations in the subsequent rows. Use the partially formed printf statements below which give you a hint at how the first two (2) rows can be formatted (you will need to complete the statements accordingly): printf("%22.41f ". printfToonies %3d 69.41f ". 7 After each table, display the calculated average cost per shirt accordingly Part-2 Output Example (Note: Use the YELLOW highlighted user-input data for submission) Set Shirt Prices ========== Enten the price for a SMALL shirt: $17.96 Enter the price fon a MEDIUM Shint.||$26.96 7. After each table, display the calculated average cost per shirt accordingly Part-2 Output Example (Note: Use the YELLOW highlighted user-input data for submission) Set Shirt Prices Enter the price fon a SMALL shirt: $17.96 Enter the price for a MEDIUM shirt: $26.96 Enter the price for a LARGE shirt $35.97 DO Shirt Store Price List ===== SMALL $17.96 MEDIUM $26.96 LARGE : $35.97 Patty's shirt size is 'S' Number of shirts Patty is buying: 6 Tommy's shirt size is 'L' Number of shirts Tommy is buying: 3 Sally's shirt size is 'M' Number of shirts Sally is buying: 4 Customer Size Price Qty Sub Total Tax Total Patty Sally Tommy S M 17.96 26.96 35.97 6 4 3 107.7600 107.8400 107.9100 14.0100 14.0200 14.0300 121.7700 121.8600 121.9400 323.5100 42.0600 365.5700 Daily retail sales represented by coins EEEEEE Sales EXCLUDING tax Coin Qty Balance Toonies Loonies 161 1 323.5100 1.5100 8.5100 5 76 100% ho Number of shirts Patty is buying: 6 Tommy's shirt size is L Number of shirts Tommy is buying: 3 Sally's shirt size is M Number of shirts Sally is buying: 4 Customer Size Price Qty Sub-Total Tax Total 6 Patty Sally Tommy IS M 1796 26.96 3597 4 107 7600 107.8400 1079100 14.0100 14.0200 14.0300 121.7700 121.8600 121.9400 B ISH HIE 323.5100 42.0600 3655700 Daily retail sales represented by coins Sales EXCLUDING tax Coin Qty Balance IMCHISI Toonies 161 Loonies 11 Quantens 2 Dimes 0 Nickels 0 Pennies 1 B2B.5100 1.5100 05100 0.0100 0.0100 0.0100 0.0000 Average cost shirt. $24.8854 Sales INCLUDING tax Coin Qty Balance Toonies 182 Loonies 1 Quarters 2 Dimes 0 Nickels 1 Pennies 2 365.5700 1.5700 05709 0.0700 00700 0.0200 0.0000 Average cost/shint: $28. 1208 Fm LE 12 (Global Scope) #define _CRT_SECURE_NO_WARNINGS #include gint round_off(int n) { if (n % 10 >= 5) { n = n / 10 + 1; else { n = n / 10; return n; Pint main(void) { int TAX = 13; const char patSize = 's', salsize = 'M', tomSize = 'L'; double small_shirt, medium_shirt, large_shirt; int shirtamount; int subtotal, taxes, total; 5 I "); printf("Set Shirt Prices "); printf(" printf("Enter the price for SMALL shirt: $"); scanf("%lf", &small_shirt); printf("Enter the price for a MEDIUM shirt: $"); scanf("%lf", &medium_shirt); printf("Enter the price for a LARGE shirt: $"); scanf("%1f", &large_shirt); printf(" "); int smallint = 1000 * small shirt; int mediumint = 1000 * medium_shirt; int largeint = 1000 * large_shirt; smallint = round_off(smallint); mediumint = round_off(mediumint); largeint round off 38 39 40 41 42 smallint = round_off(smallint); mediumint = round_off(mediumint); largeint = round_off(largeint); printf("Shirt Store Price List "); printf(" ====================== "); printf("SMALL : $%d.%d ", smallint / 100, smallint % 100); printf("MEDIUM : $%d.%d ", mediumint / 100, mediumint % 100); printf("LARGE : $%d.%d ", largeint / 100, largeint % 100); printf(" Patty's shirt size is 'S' "); printf("Number of shirts Patty is buying: "); scanf("%d", &shirtamount); 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 subtotal = smallint % shirtamount; taxes = subtotal * TAX; if (taxes % 100 >= 50) I taxes = taxes / 100 + 1; w%samew88% else { taxes = taxes / 100; 60 61 62 63 64 65 total = subtotal + taxes; 66 printf(" "); printf("Patty's shopping cart... "); printf("Contains : %d shirts ", shirtamount); printf("Sub-total: $%d%d00 ", subtotal / 100, (subtotal % 100)); printf("Taxes : $%d-%d00 ", taxes / 100, (taxes X 100)); printf("Total : $%d %deo ", total / 100, (total % 100)); 68 69 70 71 72 73 74 75 76 return 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions