Question: use c lang to solve Task2: Create a structure type to represent a battery. A battery_t variable's com ponents will include the voltage, how much

use c lang to solve

use c lang to solve Task2: Create a structure type to represent

Task2: Create a structure type to represent a battery. A battery_t variable's com ponents will include the voltage, how much energy the battery is capable of storing, and how much energy it is currently storing (in joules). Define functions for input and output of batteries. Create a function called power device that (a) takes the current of an electrical device (amps) and the time the device is to be powered by the battery (seconds) as input param eters and (b)takes a battery as an input/output parameter. The function first determines whether the battery's energy reserve is adequate to power the device for the prescribed time. If so, the function updates the battery's energy reserve by subtracting the energy consumed and then returns the value true (1). Otherwise, it returns the value false (0) and leaves the energy reserve unchanged. Also, define a function named max_time that takes a bat- tery and the current of an electrical device as the number of seconds the battery can operate the device before it is fully input parameters and returns discharged. This function does not change any of the battery's component values. Write a function recharge that sets to the maximum capacity the battery's component representing present energy reserve. Use the following equations in your design: p = power in watts(W) voltage in volts (V) -current in amps (A) w energy in joules (J) t = time in seconds (s) p = ci to = pt device. Create a main function that declares and initializes a variable to model a 12-V automobile battery with a maximum energy storage of 5 10 . Use the battery to power a 4-A light for 15 minutes, and then find out how long the battery's remaining energy could power an 8-A device. After recharging the battery, recalculate how long it could operate an S-A device

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!