Complete the program below so that it computes the price of a piece of glass. Pieces of glass are usually priced based on the type of glass and the area of the piece, but there is a minimum charge of $2.00. For clear glass (glass type 1), the charge is $6.00 per square meter; for frosted glass (type 2), the price is $10.00 per square meter. For example, the cost of a 0.25-square-meter piece of clear glass is $2.00 since 0.25 * $6.00 is $1.50, an amount less than the minimum charge. The price of a 2.4-square-meter piece of frosted glass is $24.00 (2.4 * $10.00). You do not need to do error checking in the program.
```
#include
#define CLEAR 1
#define SQMETER_CLEAR 6.00
#define FROSTED 2
#define SQMETER_FROSTED 10.00
#define MINIMUM 2.00
int
main(void)
{
double price, area;
int type;
printf("Enter glass type: %d (clear) or %d (frosted)> ",
CLEAR, FROSTED);
scanf("%d", &type);
printf("Enter area in square meters> "):
scanf("%lf", &area);
```
```
if (type == CLEAR)
price = area * SQMETER_CLEAR;
else
price = area * SQMETER_FROSTED;
if (price < MINIMUM)
price = MINIMUM;
printf("Glass price is $%.2f\n", price);\
return (0);
}
```
You might also like to view...
For the declarations below, which expression is true if ptr1 and ptr2 point at the same object? int *ptr1; int *ptr2;
a. ptr1 == ptr2 b. ptr1 == ptr2 c. (ptr1 == ptr2) d. &ptr1 == &ptr2 e. None of the above
A protocol analyzer shows that the average frame size of data packets being delivered to and from the campus network’s Internet connection is 1203. Is this a reasonable average? Justify your answer.
What will be an ideal response?
List at least five different practices to adopt in order to protect your computer from viruses and other malware.
What will be an ideal response?
What is a common reason to edit this Registry key: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run?
A. To change the Windows boot options B. To reset a password C. To change the Windows Product Key D. To delete autostarting programs