Question: Design a function called hours_remaining that takes three arguments: a. an integer value between 0 and 100 representing the percentage of battery life remaining b.

Design a function called hours_remaining that takes three arguments:

a. an integer value between 0 and 100 representing the percentage of battery life remaining

b. the brightness level of the mobile device

c. a boolean value representing whether or not the mobile device is currently streaming video

(True means streaming video, False means not streaming video)

The function returns a floating-point value representing the total number of hours of battery life left. The following algorithm is used to determine the number of hours of batter life left:

i. Multiply the MAXIMUM_BATTERY_LIFE (15 hours) by the percentage of battery left.

ii. Apply the brightness_modifier based on the current brightness level of the device.

iii. If the phone is currently streaming video, the hours remaining is cut in half.

For example, hours_remaining(80, 2, True) returns the following:

15 80% = 12 hours of regular battery remaining (80% of maximum).

12 0.75 = 9 hours after the brightness modifier is applied (brightness level of 2)

9 0.5 = 4.5 hours since the mobile device is currently streaming video

4.5 is returned. Do not round the result.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!