
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
Question
Please write this C++ code by following all the instructions
(2nd image shows the required output of the program ,green coloured is the user's input)
Thank you for your help!
![dnesday [Read-Only]- Microsof
Driver Class (Temperature driver.cpp)
Create a file Temperature driver.cpp with the main function that asks the user to
of two Temperature objects and it dynamically creates two objects of type Temperature. The
Convert, Info and Compare functions, the following results are displayed: (Text in green is
input)
Load first Temperature
Please enter city name: Aden.
What is the unit of Temperature? (F for Fahrenheit, C for Centigrade) C
You choose Celsius, so please enter Celsius value: 30.
Load second Temperature
Please enter city name: Montreal.
What is the unit of Temperature? (F for Fahrenheit, C for Centigrade) F
You choose Fahrenheit, so please enter Fahrenheit value: 12.J
Temperature of Aden is F = 86 C = 30
is greater than
Temperature of Montreal is F = 12 C = -11.11
Load first Temperature
Please enter city name: Ottawa.
What is the unit of Temperature? (F for Fahrenheit, C for Centigrade) F.J
You choose Fahrenheit, so please enter Fahrenheit value: 45
Load second Temperature
Please enter city name: London.
What is the unit of Temperature? (F for Fahrenheit, C for Centigrade) C
You choose Celsius, so please enter Celsius value: 32.J
Temperature of Ottawa is F = 45 C = 7.22
is less than
Temperature of London is F = 89.6 C = 32
Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify the
validity of user input.
Note 2: Please note that you are supposed to use the pointers at different parts of the lab question. If
you use different methods, even if your program works you do not get any mark.](https://content.bartleby.com/qna-images/question/d5ee8f6f-b196-4b10-99ae-82f5314436a3/35f3b13e-7648-410e-985c-9ba7501c0ffc/xfhokyu_thumbnail.jpeg)
Transcribed Image Text:dnesday [Read-Only]- Microsof
Driver Class (Temperature driver.cpp)
Create a file Temperature driver.cpp with the main function that asks the user to
of two Temperature objects and it dynamically creates two objects of type Temperature. The
Convert, Info and Compare functions, the following results are displayed: (Text in green is
input)
Load first Temperature
Please enter city name: Aden.
What is the unit of Temperature? (F for Fahrenheit, C for Centigrade) C
You choose Celsius, so please enter Celsius value: 30.
Load second Temperature
Please enter city name: Montreal.
What is the unit of Temperature? (F for Fahrenheit, C for Centigrade) F
You choose Fahrenheit, so please enter Fahrenheit value: 12.J
Temperature of Aden is F = 86 C = 30
is greater than
Temperature of Montreal is F = 12 C = -11.11
Load first Temperature
Please enter city name: Ottawa.
What is the unit of Temperature? (F for Fahrenheit, C for Centigrade) F.J
You choose Fahrenheit, so please enter Fahrenheit value: 45
Load second Temperature
Please enter city name: London.
What is the unit of Temperature? (F for Fahrenheit, C for Centigrade) C
You choose Celsius, so please enter Celsius value: 32.J
Temperature of Ottawa is F = 45 C = 7.22
is less than
Temperature of London is F = 89.6 C = 32
Note 1: You are to expect a perfect user who will always enter valid values; that is, do not verify the
validity of user input.
Note 2: Please note that you are supposed to use the pointers at different parts of the lab question. If
you use different methods, even if your program works you do not get any mark.
![Put the class definition in Temperature.h and the implementation of the constructors and functions in
Temperature.cpp
1. Define a class called "Temperature", that represents the information of a temperature. A Temperature is
defined with these attributes: value (double), type (char) and city (string). Functions of the Temperature
class must perform the following operations:
1. A default constructor which sets all the numeric instance variables to zero, the type to C and the String
instance variables to empty String.
2.
3.
A constructor with 3 parameters which sets the 3 instance variables to the corresponding values passed.
Implement a getter function for each of the 3 instance variables that will return the value of the instance
variable. For example, the getX() function for the instance variable type must be called get Type().
Implement a setter function for each instance variable that will assign to the instance variable to the
value passed. For example, the setX() function for the instance variable type must be called
set Type().
4.
5. A Convert function: This function converts the temperature from Fahrenheit to Celsius and
from Celsius to Fahrenheit and returns the result of the user enters 'F' for the type and the
temperature value in Fahrenheit, then this function must return the Celsius. As same if user enters 'C'
for the type and the temperature value in Centigrade, it must return the Fahrenheit value. Using the
two equations below:
Fahrenheit Celsius 1.8 +32
Celsius-(Fahrenheit - 32) /1.8
Equation 1
Equation 2
6 An Info function: this function prints the information of the object as following format:
o "Temperature of + (city)+ "isF=" + [Fahrenheit] + "C=" + (Celsius)
7. A Compare function: This function has one input parameter which is a pointer to a Temperature object
and prints a message according to following criteria:
of the temperature value of first object (the object that the Compore function is called from) is
greater than second object (input parameter in Compare, the program prints:
info of first object (using info function)+ new line+ "is greater than new line+ print info of
second object,
D
if the temperature value of first object is less than second object, the program prints
info of first object (using info function) new line+ "s less than"+new line + print info of
second object.](https://content.bartleby.com/qna-images/question/d5ee8f6f-b196-4b10-99ae-82f5314436a3/35f3b13e-7648-410e-985c-9ba7501c0ffc/5ztnqt5i_thumbnail.jpeg)
Transcribed Image Text:Put the class definition in Temperature.h and the implementation of the constructors and functions in
Temperature.cpp
1. Define a class called "Temperature", that represents the information of a temperature. A Temperature is
defined with these attributes: value (double), type (char) and city (string). Functions of the Temperature
class must perform the following operations:
1. A default constructor which sets all the numeric instance variables to zero, the type to C and the String
instance variables to empty String.
2.
3.
A constructor with 3 parameters which sets the 3 instance variables to the corresponding values passed.
Implement a getter function for each of the 3 instance variables that will return the value of the instance
variable. For example, the getX() function for the instance variable type must be called get Type().
Implement a setter function for each instance variable that will assign to the instance variable to the
value passed. For example, the setX() function for the instance variable type must be called
set Type().
4.
5. A Convert function: This function converts the temperature from Fahrenheit to Celsius and
from Celsius to Fahrenheit and returns the result of the user enters 'F' for the type and the
temperature value in Fahrenheit, then this function must return the Celsius. As same if user enters 'C'
for the type and the temperature value in Centigrade, it must return the Fahrenheit value. Using the
two equations below:
Fahrenheit Celsius 1.8 +32
Celsius-(Fahrenheit - 32) /1.8
Equation 1
Equation 2
6 An Info function: this function prints the information of the object as following format:
o "Temperature of + (city)+ "isF=" + [Fahrenheit] + "C=" + (Celsius)
7. A Compare function: This function has one input parameter which is a pointer to a Temperature object
and prints a message according to following criteria:
of the temperature value of first object (the object that the Compore function is called from) is
greater than second object (input parameter in Compare, the program prints:
info of first object (using info function)+ new line+ "is greater than new line+ print info of
second object,
D
if the temperature value of first object is less than second object, the program prints
info of first object (using info function) new line+ "s less than"+new line + print info of
second object.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 5 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
- It was claimed that:(a, b) ≤ (c, d) ⇔ (a < c) ∨ (a = c ∧ b ≤ d) defines a well-ordering on N x N. Show that this is actually the case.arrow_forwardOCaml Code: Attached are the instructions and below is the example output. Make sure to read the instructions carefully. There must be no error in the code at all and show the screenshots of the correct code and output. Be sure to write your own test cases as well and test them. I need to make sure the code works 100%.arrow_forward2)If a five-digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits. For example, if the number that is input is 12391, then the output should be displayed as 23502.arrow_forward
- 2. Please provide the correct C++ code that works with Visual studio for the following question تarrow_forward1. Please provide the correct C++ code answering the following question that works with Visual Studio.arrow_forwardRunning on a particular treadmill you burn 3.9 calories per minute. Design a program that uses a loop to display the number of calories burned after 10, 15, 20, 25, and 30 minutes. please make a pseudocode in c++arrow_forward
- Please help me with these questions. I am having trouble understanding what to do Programming Language: (HTML, CSS, JavaScript) Please provide preconditions and postconditions for each solution you provide. IMPORTANT: In Ex 9 and 10, you are not allowed to use strings. Instead, you should work with numbers and mathematical operators, such as division, remainder, etc. Ex 11) Devise a flowchart to receive a positive integer and output each digit, from right to left, after it has been multiplied by 2. For instance, if the input is 692, the program should output 4, 18, 12. As another example, if the number is 135429 the program should out put 18, 4, 8, 10, 6, and 2. Ex 12) Devise a flowchart to receive a positive number and output "yes" if each of its digits is in a non-decreasing order; otherwise, output "no". For instance, if the input is 123558, the program should output "yes", because if you read the digits from left to right, the values of the digits never decrease. But, if the…arrow_forwardPYTHON!!! The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment. Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items: The month number (beginning with 1) The current total balance owed The interest owed for that month The amount of principal owed for that month The payment for that month The balance remaining after payment The amount of interest for a month is equal to balance × rate / 12. The amount of principal for a month is equal to the monthly payment minus the interest owed. An example of the program input and output is shown below: Enter the puchase price: 200 (SEE IMAGE FOR PURCHASE PRICE CHART) Results you should get: Input: 200 Output: Purchase price: 200…arrow_forwardThe value of a comma expression is the value of the first expression. a. True b. Falsearrow_forward
- Write a “for” statement that print the following sequences of values. Submit a screen capture showing the results when the statement is run within a complete program in C++ 20, 14, 8, 2, -4, -10arrow_forwardPlease do it on Visual Studios using Python. (Use version Python3)arrow_forwardGiven code is provided down below. Please do not change the existing code. The instructions are in the image. Please explain and show each step and a screenshot of the input and output. Thank you. main.cpp #include "Triangle.h"#include "Square.h"#include <iostream> using namespace std; int main() { //Do not modify return 0;} ------------------------------------------- Square.cpp #include "Square.h"#include <iostream>using namespace std; Square::Square(){ base = 0; height = 0;} Square::Square(int b, int h) : base(b), height(h) { } void Square::setBase(int b){ base = b;} void Square::setHeight(int h){ height = h;} void Square::calculateArea(){ // calculate Area correctly depending on shape type} int Square::getBase() const{ return base;} int Square::getHeight() const{ return height;} double Square::getArea() const{ return area;}// Overloaded << operator // Overloaded >> operator ------------------------------------------- Square.h #ifndef…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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