Complete the following program. An object floats in any fluid, if the density of the object is lower than the density of the fluid. Write a program to determine whether an object will float in the oil where the density of oil is 0.92 g/cm. The program will read mass and volume of an object then computes its density and determines whether the object will float. Program consists of two functions as follows: vold input(. .): This function with two pass by reference parameters, reads mass and volume of an object from the user. string process( .): This function receives mass and volume, computes the desnity of the object using formula as shown below: density=mass / volume If the density of the object is higher than the density of oil, it will return the string "Float", if the density of the object and the oil is equal then it returns a string "Stay at some place" otherwise it will return "Submerge". main () program is given below and you are asked to write the function definitions in the space provided below. # include #include using namespace std; void input(double &, double &); string process(double, double); int main() double mass, volume; input(mass, volume); //input() called cout<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Complete the following program.
An object floats in any fluid, if the density of the object is lower than the density of the fluid.
Write a program to determine whether an object will float in the oil where the density of oil is 0.92 g/cm³.
The program will read mass and volume of an object then computes its density and determines whether the object will float.
Program consists of two functions as follows:
void input(. .): This function with two pass by reference parameters, reads mass and volume of an object from the user.
string process(. ..): This function receives mass and volume, computes the desnity of the object using formula as shown below:
density=mass / volume
If the density of the object is higher than the density of oil, it will return the string "Float", if the density of the object and the oil is equal then it returns a string "Stay at some place" otherwise it will
return "Submerge".
main () program is given below and you are asked to write the function definitions in the space provided below.
# include<iostream>
#include<string>
using namespace std;
void input(double &, double &);
string process(double, double);
int main()
double mass, volume;
input(mass, volume); //input() called
cout<<process(mass, volume)<<endl; // process() called
}//end of main program
Sample Output:
CAWindowstsystem32icmd.exe
Enter the mass of the object : 38
Enter the Volume of the object : 5
Density of the Object is : 7.6
object wil1 Float
Press any key to continue ...
Transcribed Image Text:Complete the following program. An object floats in any fluid, if the density of the object is lower than the density of the fluid. Write a program to determine whether an object will float in the oil where the density of oil is 0.92 g/cm³. The program will read mass and volume of an object then computes its density and determines whether the object will float. Program consists of two functions as follows: void input(. .): This function with two pass by reference parameters, reads mass and volume of an object from the user. string process(. ..): This function receives mass and volume, computes the desnity of the object using formula as shown below: density=mass / volume If the density of the object is higher than the density of oil, it will return the string "Float", if the density of the object and the oil is equal then it returns a string "Stay at some place" otherwise it will return "Submerge". main () program is given below and you are asked to write the function definitions in the space provided below. # include<iostream> #include<string> using namespace std; void input(double &, double &); string process(double, double); int main() double mass, volume; input(mass, volume); //input() called cout<<process(mass, volume)<<endl; // process() called }//end of main program Sample Output: CAWindowstsystem32icmd.exe Enter the mass of the object : 38 Enter the Volume of the object : 5 Density of the Object is : 7.6 object wil1 Float Press any key to continue ...
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education