Answer to Question #212277 in C++ for fazily

Question #212277

C++ PROGRAMMING

The "TRC Institute" records and monitors performance of three (3) machines over a period of four (4) days (l to 4) as shown in the Table 1, 2 and 3 respectively. The production ranges between 15.5 and 75.5 

Table 1- Machine "A" Production

1 2 3 4

Array index 0 1 2 3

Production 15.5 25.5 27.5 60.5

Table 2- Machine "B" Production

1 2 3 4

Array index 0 1 2 3

Production 50 45.5 25.5 18

Table 3- Machine "C" Production

1 2 3 4

Array index 1 2 3

Production 35.5 65 71 74.5

(b) Write a function using C++ statements called MinimumMachine() which takes three float values (valuel, value2, vlaue3) as parameters and returns the machine that has the lowest production.

MinimumMachine  returns A (represents machine A)

(c) Write a function using C++ statements called MaximumMachine() which takes three float values (valuel, value2, value3) as parameters and returns the machine that has the highest production.

Ex:

MaximumMachine (15.5,50,35.5) returns B (represents machine B)


1
Expert's answer
2021-06-30T11:55:57-0400
#include<iostream>
using namespace std;
//Answer A
char MaximumMachine(float value1, float value2, float value3){
char x;
if(value1>value2 && value1 >value3){
	x= 'A';
}
else if(value2>value1 && value2>value3){
	x ='B';
}
else if(value3>value1 && value3>value2){
	x ='C';
}
return x;	
}


//Answer B
char MinimumMachine(float value1, float value2, float value3){
char x;
if(value1<value2 && value1 <value3){
	x= 'A';
}
else if(value2<value1 && value2<value3){
	x ='B';
}
else if(value3<value1 && value3<value2){
	x ='C';
}
return x;	
}
int main(){
	float value1= 15.5;
	 float value2= 50; 
	 float value3 =30.5;
	 cout<<"The machine with the highest production is:\t"<<MinimumMachine(value1,value2,value3)<<endl;
	 cout<<"The machine with the highest production is:\t"<<MaximumMachine(value1,value2,value3);
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS