Milk is sold out on a daily basis with a rate of RM4.50/Liter. The relationship between weight w (Kg) and milk production m (Liter) is given by: ๐ = (๐ด๐ค0.54 + ๐ต) ร ๐ถ where A, B and C are the coefficients (variables). The coefficients A is 1.15 and B is 0.25. Meanwhile, for coefficient C, the rate is depending on the weight of the cow where C will be 0.2 when the weight is below 600kg and will be 0.5 when the weight of the cow is equal and above 600kg. The weight of each animal is listed in Table 1. Table 1 Cow ID 1 2 3 4 5 Weight (Kg) 500 625 718 813 995 As a programmer, you are required to help the farm owner, by writing a C program to compute the daily sell value (in RM) of milk. Any suitable control statement should be applied in your program. The sample of output is given in Figure 1.
Enter weight 1) - 500 Enter weight 2) - 625 Enter weight 3) - 718 Enter weight 4) - 813 Enter weight 5) - 995 Total milk produce in Liter = 91.12 Sell value of milk = RM410.06ย
Comments
Leave a comment