Cosc101 Exam 17 - 18
Cosc101 Exam 17 - 18
2. An NGO des,res to stir primary school pupils' interest in simple arithmetic. You are contacted
to develop , application that will act as a calculator to perfonn simple arithmetic operations,
namely, addftion, subtraction, multiplication, and division. Thus, develop this application
using functidn principles in C programming language. /
3. A Car Manufacturing finn produces three types of vehicles namely Salon cars, Jeeps and
Buses. It costs the firm 10,000 dollars to manufacture a Salon car, 23,000 dollars to
manufacture a Jeep and 27,000 dollars to manufacture a Bus. The selling price of each Salon
car is 12,000 dollars, the selling price of each Jeep is 27,250 dollars while the selling price of
each Bus is 29,199 dollars. The finn pays a tax of 10% on the sale of each Salon car, 12% on
the sale of each Jeep and 14% on the sale of each Bus. Determine the monthly profit in dollars
of the finn in a month in which it sold 25 Salon cars, 46 Jeeps and 37 Buses.
1. By problem decomposition, identify the input, processing and output
requirements
ii. Draw a flowchart to depict the solution to the problem
iii. Write a C program to solve the above problem
4. a) A restaurant manager consults you to develop a weight-driven menu application that will
help them servej their customers right type of food as compliment~ breakfast depending on
their weight. Thifollowing weight condition and suggested menu are given for breakfast:
I
I0-15kg
Egg, cereal, milk, bread, moinmoin, munchies, potatoes,
beverage,fish, beans
16-40kg Boiled yam, cereal, milk, boiled potatoes,
boiled egg,
vegetable, porridge, fish, meat, beans
41-60kg Egg, cereal, milk, bread, moinmoin, munchies, potatoes,
beverage, slightly creamed coleslaw
61-80kg
Uncreamed coleslaw, watermelon, cereal, vegetable WI'th dried
'fish, porridge, beans, moinmoin
81-90kg Beans,moinmoin, watermelon, cereal, vegetable
91kg ~d ~bov_e Vine seedless grape, fruit salad, beans, moirunoin,
- .
/ ,'
4.b) W!th
-<
~-
With f;heuse of ciompound-if, develop an application for this restaurant.
___,,
USf of for ... loop and a one-dimensional array, store your desired scores}-in all e
th
courses you are ~ng this first semester.
#include <stdi~.h>
int mainO ·
{
int sut, score;
score T 70.5;
sum =!O;
sum :::: sum +Score;
printf("The sum is %d", sum);
}
2. Specify the buggy lines of code and write out the correction
#include <stdoh>
intmainO
int x, y;
x=9;
floatz=x +y
printf("You've got it ", z);
3. Draw/map out the order of evaluation of the operators used in the following
(operator precedtnce):
a * (b + o) + die I