Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a class TaskCalculator ( ) to keep track of how much time a day's tasks will likely take. The class has a single

 

Define a class TaskCalculator ( ) to keep track of how much time a day's tasks will likely take. The class has a single attribute, daily tasks, which is created as an empty dictionary using the classes' initializer function It will then have two methods: add_task and calculate_time. add_task (task, duration) : input parameters task (a string) duration (an int or float describing the number of hours) this method will add an entry to the daily tasks dictionary, using task as the key and duration as the value calculate_time(): no input parameters the code will then determine, given the values in the instance attribute daily_tasks, how long the daily_tasks are estimated to take by summing up the dictionary values the number of hours estimated should be returned from this method if no tasks are stored then the return value should be 0 Activate Mi

Step by Step Solution

There are 3 Steps involved in it

Step: 1

To define the TaskCalculator class as per the given requirements you can use the following code pyth... 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

College Algebra Graphs and Models

Authors: Marvin L. Bittinger, Judith A. Beecher, David J. Ellenbogen, Judith A. Penna

5th edition

321845404, 978-0321791009, 321791002, 978-0321783950, 321783956, 978-0321845405

More Books

Students also viewed these Programming questions