|
Ok here’s the thing. I’m taking an MS visual C++ class in the Interamerican University in Bayamón Puerto Rico. The thing is that my professor is the worst professor in the history of any class ever taken any ware in the world. I have a C++ project due to the 27 of this month and to tell everyone the truth I don’t have a clue about what I have to do in this project. If anyone can help me with the code for this problem it will be greatly appreciated. The problem is from the book essential C++ for engineers and scientists second edition (Jeri R. Hanly). It’s the problem #5 of page 271. Here’s how it goes:
“Design and implement a class to model a battery. A battery abject should know its voltage, how much energy it is capable of storing, and how much energy it is currently storing (in joules). Include the following member functions:
powerDevice: Given the current of an electrical device (amps) and the time the device is to be powered by the battery (seconds), this function determines whether the battery’s energy reserve is adequate to power the device. If so, the function updates its energy reserve by subtracting the energy consumed and returns the value true. Otherwise it returns the value false and leaves the energy reserve unchanged.
maxTime: Given the current of an electrical devise, the function returns the number of seconds the battery can operate the device before it is fully discharged. This function does not modify the energy reserve.
reCharge: this function sets the battery’s component representing the present energy reserve to its maximum capacity.
Use the following equations in your design: p = vi p = power in watts (w) v = voltage in volts (v) w = pt i = current in amps (a) w = energy in joules (j) t = time in seconds (s) For this simulation, neglect any loss of energy in the transfer from battery to device.
Create a main function that tests your class by creating an object to model a 12-V automobile battery with a maximum energy storage of 5*10^6j. Use the battery to power a 4-A light for 15 minutes. Then find out how long the battery’s remaining energy could power an 8-A device. After recharging the battery, ask again how long it could operate an 8-A device.”
And that’s the whole problem. Any help whatsoever will be greatly appreciated. Thanks in advance.
|