Write a C++ program to add two fractions and display the result fraction. Your program will prompt the user to input fraction 1 and fraction 2. The numerator and denominator of each fraction are input...

Write a C++ program to add two fractions and display the result fraction. Your program will prompt the user to input fraction 1 and fraction 2. The numerator and denominator of each fraction are input separately by space. See the example output below. You will need to use a C++ structure to define a fraction. The structure has two members: numerator and denominator. Enter fraction 1(numerator denominator): 1 2 Enter fraction 2(numerator denominator): 2 5 10 marks Write a program is to calculate the root(s) of a quadratic equation: ax2+bx+c=0. The program firstly asks the user to input factors a, b, and c. The root(s) is calculated based on the following conditions: • If a and b are zero, then there is no root. • If a is zero, then there is one root, -c/b. • If delta is less than 0, then there is no root. • If all above conditions are not true, then there are two roots. 10 marks Learners at a local basic school volunteered to sell fresh baked bread to raise funds to increase the number of computers for their computer lab. Each student reported the number of loaves of bread he/she sold. Write a C programme that will output the total number of loaves of bread sold, the total revenue generated by selling the bread, and the average number of loaves of bread sold by each student. The input data is provided in the following form: studentIndexNo numOfBoxesSold. The programme in (1c) computes and outputs the total number of loaves of bread sold, the total money made, and the average number of loaves sold by each student. However, the programme assumes that the programmer knows the exact number of volunteers. Now suppose that you do not know the exact number of volunteers. Modify your programme in 1 i), assuming that the data is in the following form: student’s index number followed by a space and the number of loaves sold by the student. Since you do not know the exact number of volunteers, assume that -1 will mark the end of the data. 10 marks
May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here