Write a C program that uses functions. The main() method holds an integer variable named numberOfEggs to which you will assign a value. Create a method called myEggs() to which you pass numberOfEggs. The method displays the eggs in dozens; for example, 50 eggs is 4 full dozen (with 2 eggs remaining).
LOOPING STATEMENTS AND FUNCTIONS
Create a flowchart to guide you in the process
Create a function that will accept the value of i and return the value of n
Possible values of i is any positive value from 2 to 10
n is computed based on the value of i; see the following table for the sample Input / Output
i Process n
3 1*2*3 6
5 1*2*3*4*5 120
7 1*2*3*4*5*6*7 5040
Screen/Layout
(Home Screen)
Input i:3
Process: 1*2*3
Output: 6
Try Another [Y/N]: Y
Input i: 5
Process: 1*2*3*4*5
Output: 120
Try Another [Y/N]: Y
You are an employee of a marketing organization that pays you a monthly salary of Ksh. 10,000
if you work for the recommended 160 hours a month (Monday - Friday, 9am - 5pm, for a month).
This salary can however fluctuate based on the number of hours worked, in that if you work for
more than the recommended working hours ie above 160 hours, you earn an extra 10% of your
salary but if you work for less than 160 hours, you will be deducted 10% of your salary. With the
aid of a SWITCH CASE select structure Implement a program written in C++ that would help
the finance department calculate your monthly salary based on the hours worked being the input
value of the program. [5 Marks]
Design a network system where VC IDs will be assigned uniquely which avoids the VC ID
collision at the routers. Since such a system avoids the VC ID collision at the router, it should
definitely save the router's time and should improve the performance of the router. Consider Fig.
1 to prove your methodology (You should not use any other network diagrams)
Design a network system where VC IDs will be assigned uniquely which avoids VC ID collision at routers. Since such a system avoids the VC ID collision at the router, it should definitely save router's time and should improve performance of router.
a. Given the following array of 8 integers {2,3,2,1,2,5,8,2} you are required to write a
C++ program that will loop through it and re-arrange it into the following final output
{5,3,1,8,2,2,2,2} and display it . The idea is to position all values equal to 2 in the
array to come after the other values not equal to 2. The order of the other values i.e 5,1,3
and 8 does not matter as long as they appear positioned before all 2s as illustrated in the hint
below:
Initial array: {2,3,2,1,2,5,8,2}
NumbertoMove = 2
Final Array: {5,3,1,8,2,2,2,2}
Write an algorithm as a pseudocode to solve the problem above. [7 Marks]
b. Transform the pseudocode in part (a) above into an actual C++ program that filters all
values equal to 2 in the array to come after the other values not equal to 2. The order of the
other values i.e 5,1,3 and 8 does not matter as long as they appear positioned before all 2s.
Write a program that will accept a number n and display the sum of all even numbers and
the sum of all odd numbers from 1 to n and the number of rows.
Write a Java Program that prints the details of a student in the following format:-
Name :
Class :
Hobbies:
Area=length x breadth
A group of medical students were monitoring the body temperature of a patient daily basis. Students captured 10 temperature readings in Celsius on a particular day.
1. Write an Algorithm to input these ten values and get the average temperature for that day. if the average temperature value is in between 970 Fahrenheit and 990 Fahrenheit then display the message “Your body temperature is normal…”. If it is more than 100.40 Fahrenheit then display the message “You have a fever caused by an infection or illness…”.
2. Convert the above algorithm (written in part (1)) to a Python program to output the desired results