Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Type of Triangle


Is acute, obtuse , right?

Is isos, scalene, equalat? 


Pythagoras


Take in the x value y value print the hypotenuse

Take in the hypotenuse and another value print the remaining value 


BMI


Take in the


Mass Height


Print out which bmi class the user is in



Farmer Brown


Leg_number = chickens*2 + cows*4 + bees*6 


A farmer has chickens with 2 legs, cows with 4 legs, and bees with 6 legs on his farm. Write a program that, given the number of chickens, cows and bees, will output the total number of legs 


What is deadlock? What is starvation? How do they differ from each other?

Determinant


Given as input 4 space-separated integers a b c d, write a program to output the value ad – bc. The value of each integer is between - 10000 and 10000 


Compound interest


Take in the principle amount interest as % and duration of the investment in years return the accumulated amount 


Simple interest


Take in the principle amount interest as % and duration of the investment in years return the accumulated amount


QUESTION 2 (THEORY AND PRACTICAL) (30 MARKS)


Melokuhle is a very young intelligent and adventurous individual. He has recently


bought 4 quantums (taxi) to transport people around the country. As a result, he is


planning a trip to Upington.


Therefore, he has hired you to write a program in pseudocode as well as in C++ to


evaluate the fuel consumption on his 4 cars during the planned trip. The kilometers


and fuel level in the tank at the start and end of the journey should be entered by the


end-user.


Calculate for each car, the fuel used, kilometers traveled, and the overall fuel


consumption in kilometers traveled per litre of fuel.



NB write an algorithm and a code in C++

In the code editor, you are provided with a main() function that asks for an integer input from the user which represents the cash to be given to Lionel and passes it to the getGift() function call.



The getGift() function is already declared and partially defined. Your task is to complete the function definition.



The getGift() function multiplies the passed integer value by 3 and then checks if the result is even. If it is, the getGift() function adds 100 to the result. Otherwise, it adds 200 to the result.



The getGift() function would then return the result as the return type of this function is int.



Given code:



#include <iostream>


using namespace std;



int getGift(int);



int main(void) {


int cash;



cout << "Enter cash amount: ";


cin >> cash;



int result = getGift(cash);



cout << "I'm giving you P" << result;




return 0;


}



int getGift(int cash) {


// TODO: Implement the function definition



}

LATEST TUTORIALS
APPROVED BY CLIENTS