Concept explainers
Freezing and Boiling Points
The following table lists the freezing and boiling points of several substances.
Substance | Freezing Point | Boiling Point |
Ethyl alcohol | -173 | 172 |
Oxygen | -362 | -306 |
Water | 32 | 212 |
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:
• isEthylFreezing—This function should return the bool value true if the temperature stored in the temperature field is at or below the freezing point of ethyl alcohol. Otherwise, the function should return false.
• isEthyl Boi1ing—This function should return the bool value true if the temperature stored in the temperature field is at or above the boiling point of ethyl alcohol. Otherwise, the function should return false.
• isOxygenFreezing—This function should return the bool value true if the temperature stored in the temperature field is at or below the freezing point of oxygen. Otherwise, the function should return false.
• isOxygenBoi1ing—This function should return the bool value true if the temperature stored in the temperature field is at or above the boiling point of oxygen. Otherwise, the function should return false.
• isWaterFreezing—This function should return the bool value true if the temperature stored in the temperature field is at or below the freezing point of water. Otherwise, the function should return false.
• isWaterBoiling—This function should return the bool value true if the temperature stored in the temperature field is at or above the boiling point of water. Otherwise, the function should return false.
Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 13 Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Additional Engineering Textbook Solutions
Starting Out with C++: Early Objects (9th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out With Visual Basic (8th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
- ngineering Computer ScienceQ&A Libraryin c++ Create a class time24, each object is a value represented the time of day in the form hours, minutes and seconds. Provide a constructor that enables an object of this class to be initialized when it is instantiated. The constructor should contain default values in case no initializes are provided. Provide Public member functions for each of the following operations: set the time, print the time, increment the time by one second, compare two times for equality, increment the time by one hour, determine if one time is “less than” (comes before) another time, and final print the time in format 12 hours. Include any additional operations that you think would be useful for your class. Design, implement, and test your class. in c++ Create a class time24, each object is a value represented the time of day in the form hours, minutes and seconds. Provide a constructor that enables an object of this class to be initialized when it is…arrow_forwardIn order to use the assignment operator on an instance of a class data type, it must be overloaded. Group of answer choices True Falsearrow_forwardWe use the _____ operator to create an instance of (object in) a particular class.arrow_forward
- True or FalseA base class reference variable can reference an object of any class that is derived from the base class.arrow_forward8. Circle ClassWrite a Circle class that has the following member variables:• radius: a double• pi: a double initialized with the value 3.14159The class should have the following member functions:• Default Constructor. A default constructor that sets radius to 0.0.• Constructor. Accepts the radius of the circle as an argument.• setRadius. A mutator function for the radius variable.• getRadius. An accessor function for the radius variable.• getArea. Returns the area of the circle, which is calculated as area = pi * radius * radius• getDiameter. Returns the diameter of the circle, which is calculated as diameter = radius * 2• getCircumference. Returns the circumference of the circle, which is calculated as circumference = 2 * pi * radiusWrite a program that demonstrates the Circle class by asking the user for the circle’s radius, creating a Circle object, and then reporting the circle’s area, diameter, and circumference.…arrow_forwardCircle Class (Easy) Write a Circle class that has the following member variables: radius : a double The class should have the following member functions: Default Constructor: default constructor that sets radius to 0.0. Constructor: accepts the radius of the circle as an argument. setRadius: an mutator function for the radius variable. getRadius: an accessor function for the radius variable. getArea: returns the area of the circle, which is calculated as area = pi * radius * radius getCircumference: returns the circumference of the circle, which is calculated as circumference = 2 * pi * radius Step1: Create a declaration of the class. Step2: Write a program that demonstrates the Circle class by asking the user for the circle’s radius, creating Circle objects, and then reporting the circle’s area, and circumference. You should create at least two circle objects, one sets the radius to 0.0 and one accepts the radius as an…arrow_forward
- IN C++ Design a class that stores a temperature in a temperature member variable and has the appropriate constructor, setter and getter functions. In addition to these, the class should have the following member functions: isEthylFreezing. This function should return the bool value true if the temperature stored in the temperature field is at or below the freezing point of ethyl alcohol. Otherwise, the function should return false. isEthylBoiling. This function should return the bool value true if the temperature stored in the temperature field is at or above the boiling point of ethyl alcohol. Otherwise, the function should return false. • isWaterFreezing. This function should return the bool value true if the temperature stored in the temperature field is at or below the freezing point of water. Otherwise, the function should return false. isWaterBoiling. This function should return the bool value true if the temperature stored in the temperature field is at or above the boiling…arrow_forwardThere are two types of data members in a class: static and non-static. Give an example of real-world use for a static data member.arrow_forwardDescribe the processes involved in making a class's member variable static in programming terms.arrow_forward
- C# languageWrite a program to create a class employee, it consist of ID, name, department and address. All employees belongs to “Computer Science” department and it can never be changed by any means. Employee ID is initialized only once when Employee object is created, any further attempt to change ID should be failed. Class must have a 3 parameterized constructor to set values and two methods: print(): to display all the data of a particular employee totalObjects(): to count and print total number of objects that has been created In Main(), create atleast two objects of employee class, display their records by calling print() function and also print the total number of objects that has been created. [this question is continued on next page] Sample Main Method: static void Main(string[] args) { Employee obj1 = new Employee(1, "Zubair", "Karachi"); obj1.print(); Employee obj2 = new Employee(2, "Nabeel", "Islamabad"); obj2.print();…arrow_forwardCar Class in C++ language whole task is in the picturearrow_forwardTrue or False It is legal to write a class without any constructors.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT