Use code C language
// SKUs of products that have 15% discount
const int DISCOUNTED[7] = { 27638, 72646, 39044, 50948, 52363,
37462, 38511 }
Task Seven Implement the function void drawPrices(int numOfProducts, int productSkus[]). This function draws a figure that shows how some product prices compare to each other. It accepts the number of products we wish to compare, and an array of SKUs of the products to compare. Each product will be represented by a black bar that has width 30. The length of the bar will be equal to ceiling(price of product) x 10. Bars are separated from each other by 20 white pixels. The picture should have height equal to 500 pixels, and width equal to (30 x numOfProducts + 20 x numOfProducts + 1) pixels. Check figure 5 for more details. It contains a drawing for 8 products (the 8th does not appear in the picture because it does not exist in products.txt so it was ignored). Note 1: If the price is of a product is on discount, use the discounted price. Note 2: If any provided SKU is not in the list of products, PRINT an error message as follows: "SKU 58312 is not available! Ignoring!", where 58312 in this example is the SKU of the product that was not found in product.txt. Page 13 of 15 HT 30x8+20x8+1 4011 ceil(20.5) x 10 = 210 Al 20 500 سين التقنية Al Hussein Techni
64967 0.5 75493 7.3 45763 2.5 31402 1.2 59927 3.7 27638 1.65 72327 2.05 64695 3.15 42377 0.3 49250 0.5 72646 1.0 14371 0.35 39044 1.8 44763 1.2 50948 3.5 52363 5.5 57369 2.35 56184 7.9 15041 2.0 39447 2.0 68178 19.5 38753 20.50 66958 1.87 30784 2.25 17361 3.25 33439 0.5 29998 3.5 37462 0.40 38511 34.16 62896 2.95
Use code C language // SKUs of products that have 15% discount const int DISCOUNTED[7] = { 27638, 72646, 39044, 50948,
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am