Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Freeze Protocol should define the following methods: chill() -> after this method is called temperature() should return the string chilling. thaw() -> after this

The Freeze Protocol should define the following methods:

  • chill() -> after this method is called temperature() should return the string "chilling".
  • thaw() -> after this method is called temperature() should return the string "thawing".
  • temperature() -> Return the temperature of the item. Initially, an item is always "thawing".

The Freezer class defines the following methods:

  • put(self, item: Feezer) -> put an item in the freezer. Call the item's chill() method.
  • take(self, item_name: str) -> take the first item that matches of the specified name out of the freezer. Call the item's thaw() method. You can assume that if an item is asked for it is already in the freezer.

 

from typing import Protocol class Freeze (Protocol): def chill(self) -> str: def thaw(self) -> str: *** def temperature (self) -> str: temperature = 'chilling' if self.chill(): temperature = 'chilling' elif self.thaw(): temperature = 'thawing' I am not sure if I am implementing very good the part that says: "temperature() -> Return the temperature of the item. Initially an item is always "thawing"." Also in the Freezer class the parameters inside the parenthesis have me confused. What do they mean by (self, item: Feezer) and (self, item_name: str)?

Step by Step Solution

3.33 Rating (144 Votes )

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

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

What are some of the topics they study?

Answered: 1 week ago