Answer to Question #294533 in C++ for Babyface

Question #294533

A batch of concrete is made using the following materials *cement=30,000kg *Sand=50,000kg *Gravel=17,500kg *Water=3000kg a)Write a C++ program code to calculate and display the amount of sand in a real number and a percentage of the total mass of concrete. b)The amount of water in real number,and a percentage of the amount of cement.​

1
Expert's answer
2022-02-06T12:30:36-0500


#include <iostream>


using namespace std;




int main() {
	float cement=30000;
	float sand=50000;
	float gravel=17500;
	float water=3000;


	//calculate and display the amount of sand in a real number and a percentage of the total mass of concrete. 
	float totalMass=cement+sand+gravel+water;
	float percentageTotalMass=(sand/totalMass)*100.0;
	float percentageCementTotalMass=(cement/totalMass)*100.0;
	cout<<"The amount of sand in a real number: "<<sand<<"\n";
	cout<<"A percentage of the total mass of concrete: "<<percentageTotalMass<<"%\n";
	//The amount of water in real number,and a percentage of the amount of cement
	cout<<"The amount of water in a real number: "<<water<<"\n";
	cout<<"A percentage of the amount of cement: "<<percentageCementTotalMass<<"%\n";


	cin>>cement;
	return 0;
}

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