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 field and has the appropriate accessor and mutator methods for the field. In addition to appropriate constructors, the class should have the following methods:
- isEthylFreezing. This method should return the boolean value true if the temperature stored in the temperature field is at or below the freezing point of ethyl alcohol. Otherwise, the method should return false.
- isEthylBoiling. This method should return the boolean value t rue if the temperature stored in the temperature field is at or above the boiling point of ethyl alcohol. Otherwise, the method should return false.
- isOxygenFreezing. This method should return the boolean value true if the temperature stored in the temperature field is at or below the freezing point of oxygen. Otherwise, the method should return false.
- isOxygenBoiling. This method should return the boolean value true if the temperature stored in the temperature field is at or above the boiling point of oxygen. Otherwise, the method should return false.
- isWaterFreezing. This method should return the boolean value true if the temperature stored in the temperature field is at or below the freezing point of water. Otherwise, the method should return false.
- isWaterBoiling. This method should return the boolean value true if the temperature stored in the temperature field is at or above the boiling point of water. Otherwise, the method should return false.
Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Concepts Of Programming Languages
SURVEY OF OPERATING SYSTEMS
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (8th Edition)
Vector Mechanics for Engineers: Statics
Starting Out with C++: Early Objects (9th Edition)
- Temp Class - Create Temp class whos job is to hold a temp in degrees F and gives methods to get the temp in F, Celsius, and Kelvin. The class should follow the instance variable (field): ftemp (double type that holds F temp)Follow these methods with the class.. Constructor --Will accept Fahrenheit temperature as a double to store it in the ftemp field. setFahrenheit - The setFahrenheit method accepts a Ftemperature as a doubleto stores it in the ftemp field. getFahrenheit - Returns the value of the ftemp field, as a Fahrenheit temperature (no conversion required). getCelsius - Returns the value of the ftemp field converted to Celsius. [C e l s i u s = ( 5.0 / 9.0 ) × ( F a h r e n h e i t − 32 )] getKelvin - Returns the value of the ftemp field converted to Kelvin. [K e l v i n = ( ( 5.0 / 9.0 ) × ( F a h r e n h e i t − 32 ) ) + 273] Exemplify the temp class by writing a (test) program that is separate and promotes users for an F Fahrenheit temp. The program must create an…arrow_forwardTrue or false: A class may have a constructor with no parameter list, and an overloaded constructor whose parameters all take default arguments.arrow_forwardJAVA Use the numbers 65, -264, -43 to test out code.arrow_forward
- Design a Ship class that the following members: A field for the name of the ship (a string). A field for the year that the ship was built (a string). A constructor and appropriate accessors and mutators. A toString method that displays the ship’s name and the year it was built. Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members: A field for the maximum number of passengers (an int). A constructor and appropriate accessors and mutators. A toString method that overrides the toString method in the base class. The CruiseShip class’s toString method should display only the ship’s name and the maximum number of passengers. Design a CargoShip class that extends the Ship class. The CargoShip class should have the following members: A field for the cargo capacity in tonnage (an int). A constructor and appropriate accessors and mutators. A toString method that overrides the toString method in the base class. The…arrow_forwardTrue or false: Just as a class can have multiple constructors, it can also have multiple destructors.arrow_forwardin C# languageDesign a Book class that holds the title, author’s name, and price of the book. Books’s constructor shouldinitialize all of these data members except the price which is set to 500/-. Create a display method thatdisplays all fields.All Books are priced at 500/- unless they are PopularBooks. The PopularBooks subclass replaces theBookprice and sets each Book’s price to 50,000/- through PopularBooks construcor. Override the displaymethod to display all fields.Write a Main () method that declares an array of five Book objects. Ask the user to enter the title andauthor for each of the 5 Books. Consider the Book to be a PopularBook if the author is one of the following:Khaled Hosseini, Oscar Wilde, or Rembrandt. Display the five Books’ details.arrow_forward
- Questionarrow_forward#pyhton programing topic: Introduction to Method and Designing class Method overloading & Constructor overloading ------------------ please find the attached imagearrow_forwardTrue or FalseIt is a common practice to make all a class’s fields private and to provide access to those fields through methods.arrow_forward
- Parking Ticket SimulatorFor this assignment you will design a set of classes that work together to simulate apolice officer issuing a parking ticket. The classes you should design are:• The Parkedcar Class: This class should simulate a parked car. The class's respon-sibilities are:To know the car's make, model, color, license number, and the number of min-utes that the car has been parkedThe BarkingMeter Class: This class should simulate a parking meter. The class'sonly responsibility is:- To know the number of minutes of parking time that has been purchased• The ParkingTicket Class: This class should simulate a parking ticket. The class'sresponsibilities areTo report the make, model, color, and license number of the illegally parked carTo report the amount of the fine, which is $2S for the first hour or part of anhour that the car is illegally parked, plus $10 for every additional hour or part ofan hour that the car is illegally parkedTo report the name and badge number of the police…arrow_forwardJava Assignment Outcomes: Student will demonstrate the ability to utilize inheritance in a Java program. Student will demonstrate the ability to apply the IS A and HAS A relationships. Program Specifications: Start by watching Video Segment 16 from Dr. Colin Archibald's video series (found in the module overview). Key in the program shown in the video and make sure it works. Then, add the following: Animals have a Weight. Animals have a Height. Dog is an Animal. Dogs have a Name. Dogs have a Breed. Dogs have a DOB. Cat is an Animal Cats have a Name. Cats have 9 lives, so you need to keep track of the remaining lives once a cat dies. Bird is an Animal Birds have a wing span Birds have a canFly which is true or false (some birds cannot fly) Create a test class that creates one of each type of animal and displays the animal’s toString method. Submission Requirements: You must follow the rules from the prior assignments. UMLs and Design Tools are not required for this one. YOU MAY…arrow_forwardThere should only be one constructor for every class. True Falsearrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT