Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a class called Temperature. 1. The __init__ method for Temperature should store two attributes: scale and measure. The attribute scale is a string and

Make a class called Temperature.

1. The __init__ method for Temperature should store two attributes: scale and measure. The attribute scale is a string and the measure a float. The init method should allow the creation of an instance providing values for the attributes.

2. Make a method called describe_ temp that prints these two pieces of information,

3. Make a method called printscale. The method checks if the value of the scale is Celsius and if yes it prints a message the temperature scale is Celsius otherwise it prints The temperature it is not in Celsius.

4. Make a method called setmeasure that will set the measure to a given value

5. Make a method called getmeasure that will return the measure

6. Make one instance of the Temperature class and name it mytemperature and provide initial values of your choice.

7. Use the merhod describe_ temp to print the attributes

8. Use the method printscale to print the message.

9. Use the method setmeasure to change the measure to one of your choice.

10. Use the method getmeasure to print the measure

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions