Question: PART B: PROBLEM SOLVING QUESTION (15 marks) Farmers from Sri Ternak Sdn. Bhd. are proposing a technique for animal diet formulation to maximize animal weight

 PART B: PROBLEM SOLVING QUESTION (15 marks) Farmers from Sri Ternak

PART B: PROBLEM SOLVING QUESTION (15 marks) Farmers from Sri Ternak Sdn. Bhd. are proposing a technique for animal diet formulation to maximize animal weight gain through their monthly feed intake. The table below shows the monthly intake of each group of animals (in kg). Animal Chickens Cattles Goats Fishes Ducks Sheep Feed (in kg) 72 140 100 67 97 217 You are required to assist the farmers by writing a program that will execute the followings: a) Declare a two-dimensional array named animal. Initialize all the animal names provided in the table into your array. b) Declare one-dimensional array named feed_kg to store the weight of feed. Initialize the array with the values as shown in the table above. c) Request feed prices for each type of animal and store into one-dimensional array named feed_price. d) Calculate the total prices for each feed and stored in one-dimensional array named total. e) Use user-defined function named Display ( ) to show all the output as in the sample output below. f) You are not allowed to use any global variables in this program. g) Bolded text indicated input from user. Sample Output: Enter price per kg for each animal food: Chickens :1.50 Cattles :4.25 Goats :3.75 Fishes :1.90 Ducks :3.50 Sheep :4.55 Animal Weight(kg) Price(RM) Total(RM) Chickens 72.00 RM1.50 Cattles 140.00 RM4.25 Goats 100.00 RM3.75 Fishes 67.00 RM1.90 Ducks 97.00 RM3.50 Sheep 217.00 RM4.55 Press any key to continue... RM108.00 RM595.00 RM375.00 RM127.30 RM339.50 RM987.35

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!