Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need pogram in c++ 1. We are going to write a program to gure out if several ele

ID: 3766684 • Letter: N

Question

Need pogram in c++

1. We are going to write a program to gure out if several elements are boiling or melting.

Design a class that stores a temperature in a temperature member variable and has the appropriate accessor and mutator functions.

In addition to appropriate constructors, the class should have the following member functions for each of the elements:

• isZincMelting. This function should return the bool value true if the temperature stored in the temperature eld is at or above the melting point and below the boiling point of zinc. Otherwise, the function should return false.

• isZincBoiling. This function should return the bool value true if the temperature stored in the temperature eld is at or above the boiling point of zinc. Otherwise, the function should return false.

• Similarly you should have isBariumMelting, isBariumBoiling

• Similarly you should have isMercuryMelting, isMercuryBoiling

• Similarly you should have isUraniumMelting, isUraniumBoiling

Write a program that demonstrates the class.

The program should ask the user to enter a temperature, and then display a list of the substances that will melt at that temperature and those that will boil at that temperature.

For example, if the temperature is 1764 the class should report:

Zinc boils, Barium melts, Mercury boils and Uranium is solid

Substance Melting Point Boiling Point Zinc (Zn) 787.15°F 1665°F Barium (Ba) 1341°F 3353°F Mercury (Hg) -37.89°F 674.11°F Uranium (U) 2070°F 7468°F

Explanation / Answer

Here is the code for you. If you have any further queries, just get back to me:

#include <iostream>
using namespace std;

class BoilingMeltingPoints
{
double temperature;
public:
void setTemperature(double temp)
{
temperature = temp;
}
double getTemperature()
{
return temperature;
}
bool isZincMelting()
{
if(temperature >= 787.15 && temperature < 1665)
return true;
return false;
}
bool isZincBoiling()
{
if(temperature >= 1665)
return true;
return false;
}
bool isBariumMelting()
{
if(temperature >= 1341 && temperature < 3353)
return true;
return false;
}
bool isBariumBoiling()
{
if(temperature >= 3353)
return true;
return false;
}
bool isMercuryMelting()
{
if(temperature >= -37.89 && temperature < 674.11)
return true;
return false;
}
bool isMercuryBoiling()
{
if(temperature >= 674.11)
return true;
return false;
}
bool isUraniumMelting()
{
if(temperature >= 2070 && temperature < 7468)
return true;
return false;
}
bool isUraniumBoiling()
{
if(temperature >= 7468)
return true;
return false;
}
};

int main()
{
BoilingMeltingPoints bmPoint;
double temp;
cout<<"Enter the temperature: ";
cin>>temp;
bmPoint.setTemperature(temp);
cout<<"Zinc ";
if(bmPoint.isZincBoiling())
cout<<"boils, ";
else if(bmPoint.isZincMelting())
cout<<"melts, ";
else
cout<<"is solid, ";
cout<<"Barium ";
if(bmPoint.isBariumBoiling())
cout<<"boils, ";
else if(bmPoint.isBariumMelting())
cout<<"melts, ";
else
cout<<"is solid, ";
cout<<"Mercury ";
if(bmPoint.isMercuryBoiling())
cout<<"boils, ";
else if(bmPoint.isMercuryMelting())
cout<<"melts, ";
else
cout<<"is solid, ";
cout<<"and Uranium ";
if(bmPoint.isUraniumBoiling())
cout<<"boils. ";
else if(bmPoint.isUraniumMelting())
cout<<"melts. ";
else
cout<<"is solid. ";
cout<<endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote