Write a program to compute selling-price of sugar that is to be sold in boxes of
ID: 3773435 • Letter: W
Question
Write a program to compute selling-price of sugar that is to be sold in boxes of different geometric shapes. The price of the sugar is to be calculated according to the volume of the box. Unit price listing of sugar with respect to box volume-thresholds are as listed below;
Volume (cm3) Price for one cm3 (TL)
0 « 500............................ 120
501 « 1000.......................... 100
1001 « 2500......................... 80
2501 « 5000......................... 65
+5001...................................... 50
User can define his/her own geometric shape and size for the sugar box. However, all the geometric shapes should be regular. User will initially enter the edge count for his/her selection of box-profile (triangle, square, hexagonal, pentagonal, octagonal…--polygons--) then s/he will enter the profile-edge length and the height for the box in centimeters (fractions are allowed). Your program is to calculate the profile area, total volume and total price for the sugar that will be sold in user-defined box. Program should output these values (profile-area, box-volume, total sugar –price) as well.
The following formula can help in calculating the profile area of the regular geometric shapes;
where edgecount: the number of edges in the regular geometric shape of the profile
edgelength: length of an edge on the regular geometric shape of the profile
Here, 180 is in Degrees in the above given formula, you should convert it to Radians in order to use the formula in C compiler.
Sample Run 1:
Enter edge count for box profile: 4
Enter the profile-edge length and box-height: 5.8 6.5
Box profile area is 33.64 cm square.
Box volume is 218.66 cm cube.
Total sugar price is 26239.20 TL.
Sample Run 2:
Enter edge count for box profile: 7
Enter the profile-edge length and box-height: 2.15 3.25
Box profile area is 16.80 cm square.
Box volume is 54.60 cm cube.
Total sugar price is 6551.13 TL.
IMPORTANT: CODING DIRECTIONS
There should be 3 functions with the names “calculate_profile_area”, “calculate_volume” and “calculate_price” in your code. The parameters which will be passed to the functions and function return values will be decided by you. All input and output number fractions will be limited by two digits. Your homework program structure should be as follows:
// Your compiler directives goes here
...
...
// Function prototypes
??? calculate_profile_area (???);
??? calculate_volume (???);
??? calculate_price (???);
// Your main function statements
??? main(void)
{ ...
...
...
}
// Statements for function calculate_profile_area
??? calculate_profile_area(???)
{ ...
...
...
}
// Statements for function calculate_volume
??? calculate_volume(???)
{ ...
...
...
}
// Statements for function calculate_price
??? calculate_price(???)
{ ...
...
...
}
Postalar Gozden GesitGorünGm AaBbCal AaBbCc Paragra price for the sugar that will be sold in user-defined box. P values (profile-area box-volume, total sugar-price) as well The following formula can help in calculating the profile are shapes edgelmgrh 80 180 4 1 where edzecaunt the number of edges in the regular geometnc sha egeleses lerigth of an edge on the regular geometric shape Here, 180 is in Deghees in the abave grven fannula, you should c order to use the formula in C compiler Box pioflle aai 33.meExplanation / Answer
Sample code:
Sample output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.