
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question

Transcribed Image Text:The following problem is based on a problem in a number of Java texts, including Gaddiss':
Write a Temperature class that will hold a temperature in Fahrenheit and provides
methods to get and display the temperature in Fahrenheit, Celsius, and Kelvin.
The Temperature class should have the following instance variable:
ftemp - A double that holds a Fahrenheit temperature.
The Temperature class should have the following methods:
ReadInput - Uses a Scanner method to populate ftemp with double value.
getFahrenheit - Returns the value of the ftemp field, as a Fahrenheit temperature.
getCelsius - Returns the value of the ftemp field converted to Celsius.
getKelvin - Returns the value of the ftemp field converted to Kelvin.
DisplayOutput - The Fahrenheit temperature and the equivalent values in Celsius and
Kelvin are gotten and displayed, one per line, and each along with an
appropriate message.
Use the following formula to convert the Fahrenheit temperature to Celsius:
Celsius = 5.0/9.0 (Fahrenheit - 32)
Use the following formula to convert the Fahrenheit temperature to Kelvin:
Kelvin = 273 + 5.0/9.0 * (Fahrenheit - 32)
Demonstrate the Temperature class by writing a separate class that includes a main()
method.
The demo program should
create an instance (ie, an object) of the Temperature class,
invoke the ReadInput() method on the object
invoke the DisplayOutput method on the object
Input Data:
Within ReadInput() method, use a Scanner method to enter a double value for ftemp at
the keyboard

Transcribed Image Text:Processing:
Within the Temperature class, set up the following methods:
ReadInput ()
getFahrenheit ()
getCelsius ()
getKelvin ()
DisplayOutput ()
Within the demo program,
set up the main () method
within the main () method,
set up an object of the Temperature class
invoke the ReadInput() method on the object
invoke the DisplayOutput() method on the object
Output Data:
Display ftemp and the equivalent values in Celsius and Kelvin
To get the values, make calls to getFahrenheit (), getCelsius (), and getKelvin () within
output statement(s)
Here's a sample output (Assuming that the input data is 32 degrees Fahrenheit):
32 degrees in Fahrenheit is equivalent to:
=> 0 degrees Celsius
=> 273 degrees Kelvin
End of the program
===
==================
Within your solution, include the following 3 sections:
====
Input Data: document variables used to hold input data
o Output Data: document variables used to hold output data
o Processing: document the formulas/expression(s) you set up as part of your
processing
Add the following:
O
Documentation
o Coding: The solution is complete and working properly
o
Including the program output
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
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
- For this lab task, you will work with classes and objects. Create a class named text that works similar to the built-in string class. You will need to define a constructor that can be used to initialize objects of this new class with some literal text. Next, define three methods: to_upper() that will convert all characters to uppercase, reverse() that will reverse the text and length() that will return the length of the text. After you have completed this part, copy the following mainfunction to your code and check if the implementation is correct. int main() { text sample = "This is a sample text"; cout << sample.to_upper(); // This should display "THIS IS A SAMPLE TEXT" cout << endl;cout << sample.reverse(); // This should display "txet elpmas a si sihT"cout << endl; cout << sample.length(); // This should display 21 }arrow_forwardDefine a new “Degree” class that contains a year (integer), a subject (string) and a person’s name (string). For example, a degree can haveo John Smith, 2020, Computer Science It should have at least the following methods: o toString method must return all the degree information: year,subject and person’s name in the following format:NAME(John Smith) SUBJECT(Computer Science) YEAR(2020)o hasTheSameDegree method that compares 2 degrees and returntrue if both have the same year and the same subject. Otherwise, itreturns false. Important notes:You can add as many other methods as you need. But this class should not provide the default constructor. Show how this class being used to create Degree objects and how these methods are being called and return proper values. All data members must be declared as “private” No global variable is allowed to be declared and used Methods within the class and the requested functions cannot have “cin” or “cout” but it should make use of parameters and…arrow_forwardCreate another class DayProg and write the main() method to display the following: Today is 2022-02-03. The Daylight-Saving Time start day is 2022-03-13. There are 38 days until the Daylight-Saving Time start day. The date after 19 days is: Year : 2022 Month: 2 Day : 22arrow_forward
- Design a class called "Person" with attributes for name, age, and gender. Implement methods to get and set these attributes, and also a method to calculate the person's age in dog years (assuming 1 dog year is equivalent to 7 human years).arrow_forwardWrite a main method, in which you should have an Arralylist of students, in which you should include every student. You should have a PhD student named Joe Smith. In addition, you should create an Undergraduate student object for each of your team members (setting their names). If you’re only one person doing the assignment, then you should just create one undergraduate object. For each undergraduate student, you should add add two courses (COIS 2240 and COIS 1020). Loop over the arraylist of students, print their names, if the student is an undergraduate student, print their courses.arrow_forwardUse Java program to add a method printReceipt to the CashRegister class. The method should print the prices of all purchased items and the total amount due. Hint: You will need to form a string of all prices. Use the concat method of the String class to add additional items to that string. To turn a price into a string, use the call String.valueOf(price). Also, the payment information will need to be the same as the price information. Here is the CashRegister class: /** A cash register totals up sales and computes change due.*/public class CashRegister{ private double purchase; private double payment; /** Constructs a cash register with no money in it. */ public CashRegister() { purchase = 0; payment = 0; } /** Records the sale of an item. @param amount the price of the item */ public void recordPurchase(double amount) { purchase = purchase + amount; } /** Processes a payment received from the customer. @param…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education