Flow control is one of the main building blocks that determines how a program should run. Ghana Cocoa Growing company wishes to compare the impart of two newly acquired fertilizers on cocoa. They will do this by applying the same quantity of the two fertilizers on two similar but different cocoa plant under the same conditions (humidity, sunlight, soil moisture etc.). They will then choose the fertilizer whose crop produces the best harvest (highest quantity per square feet). As a programmer,
c. create a method that takes four arguments i.e. (the names of the two fertilizer and their individual yields). The methods should return the name of the fertilizer with the greatest yield.
d. Using “c” above, write a program that request for two fertilizer name and their respective yields. Your program should display the fertilizer with the most yield
e. Discuss your answer in “d” above
Problem 5: Suppose there is a list s1->s2->s3->………->sn-1 ->sn. given to you. You need to modify this list in such a way that it will be s1->sn ->s2->sn-1 ->s3->sn-2……. Note: algorithm should be inplace without modifying the values of the nodes. Marking Scheme: Total 10 marks ( Algorithm explanation + Pseudo-code + runtime and data structure used)
D is hosting a lunch and R is incharge of the sitting plan D’s dining table is an infinite row of seats with D at one end. Each of D’s guests represents a alphabet (a to z). D want guests to be seated such that the resulting string formed from the alphabets is smallest He didn’t tell total number of guests.
The rules:-
● Seats are allotted in sequential order, a guest who arrives later must be further from D
● An incoming guest must be assigned a seat, as soon as he arrives
● Once a guest take seat, you can’t ask them to move to some other seat.Even if
the seat in front of him is empty.
● But you can make a guest disappear, D has allowed to make at most k of his guests disappear but you can’t remove more than k guests.
● No seat should remain empty b/w any 2 guests or b/w guest and D, a series of empty seats would be in the end. You are R, design a code using an efficient data structure that will follow to keep track of which guest to assign which seat.
Flow control is one of the main building blocks that determines how a program should run. Ghana Cocoa Growing company wishes to compare the impart of two newly acquired fertilizers on cocoa. They will do this by applying the same quantity of the two fertilizers on two similar but different cocoa plant under the same conditions (humidity, sunlight, soil moisture etc.). They will then choose the fertilizer whose crop produces the best harvest (highest quantity per square feet). As a programmer,
a. Suggest a flow control method that would be used to do the comparison and explain the reason why you chose it.
b. Write a flow control statement that would do the comparison in “a” above.
Problem 3: In the country of WeirdLand, there is only one barber shop. In the shop there are 3 barbers, Alpha, Beta and Gamma, who are not always efficient as employees. All the customers are seated in a waiting area, each customer has a card which has a unique integral ID. For calling next person from the waiting area each barber has his own weird way: Alpha: He will call either the person with least ID from the waiting area of the one with max ID. Min or Max is decided randomly by him (assume 50% probability for each min or max). Beta: He will choose a ‘k’ and will call the kth smallest ID, (Kth ID when all IDs are arranged in ascending order). K is chosen randomly from the number of persons available in waiting area (1 <= K <= Total persons)
In the country of WeirdLand, there is only one barber shop. In the shop there are 3
barbers, Alpha, Beta and Gamma, who are not always efficient as employees. All the customers are seated in a waiting area, each customer has a card which has a unique integral ID. For calling next person from the waiting area each barber has his own weird way:
Alpha: He will call either the person with least ID from the waiting area of the one with max ID. Min or Max is decided randomly by him
Beta: He will call the kth smallest ID, (Kth ID when all IDs are arranged in ascending order). K is chosen randomly(1 <= K <= Total persons)
Gamma: He will always choose the median ID. If there are ‘n’ people in the waiting area, the median will be defined as (n+1)/2 th ID when all of them are arranged in ascending order. (For both odd and even ‘n’ )
Your task is to design a data structure which should support the query of each of the three
barbers. The data structure should be highly efficient.
hoping for answer im so glad this website is make.i shared it on my friend
a. The length and width, in inches, of the picture.
b. The type of the frame.
c. Customer’s choice of color to color the frame.
d. If the user wants to add the crowns, then the number of crowns.