Question: Which function is most appropriate to improve the given code? Flowchart Main has 1 0 float variables ( powerConsumptionApp 1 , powerConsumptionApp 2 , powerConsumptionApp

Which function is most appropriate to improve the given code?
Flowchart Main has 10 float variables (powerConsumptionApp1, powerConsumptionApp2, powerConsumptionApp3, hoursOfUse1, hoursOfUse2, hoursOfUse3, energyPerDay1, energyPerDay2, energyPerDay3, totalEnergyConsumed) and 15 nodes. Node 1 is the start node and points to node 2. Node 2 code: powerConsumptionApp1=600.85 Node 2 points to node 3. Node 3 code: hoursOfUse1=12.8 Node 3 points to node 4. Node 4 code: energyPerDay1=(powerConsumptionApp1* hoursOfUse1)/1000 Node 4 points to node 5. Node 5 code: powerConsumptionApp2=1800.45 Node 5 points to node 6. Node 6 code: hoursOfUse2=0.45 Node 6 points to node 7. Node 7 code: energyPerDay2=(powerConsumptionApp2* hoursOfUse2)/1000 Node 7 points to node 8. Node 8 code: powerConsumptionApp3=70 Node 8 points to node 9. Node 9 code: hoursOfUse3=1.5 Node 9 points to node 10. Node 10 code: energyPerDay3=(powerConsumptionApp3* hoursOfUse3)/1000 Node 10 points to node 11. Node 11 code: totalEnergyConsumed = energyPerDay1+ energyPerDay2+ energyPerDay3 Node 11 points to node 12. Node 12 puts to output the string: The total energy consumed per day is Node 12 points to node 13. Node 13 code: Put totalEnergyConsumed to output Node 13 points to node 14. Node 14 puts to output the string: .
Node 14 points to node 15. Node 15 is the end node.
a.
Flowchart ComputeTotal has 3 parameter variables (float energyPerDay1, float energyPerDay2, float energyPerDay3),1 return variable (float total), and 3 nodes. Node 1 is the start node and points to node 2. Node 2 code: total = energyPerDay1+ energyPerDay2+ energyPerDay3 Node 2 points to node 3. Node 3 is the end node.
b.
Flowchart InputValues has 2 parameter variables (float power, float hours),no return variable, and 4 nodes. Node 1 is the start node and points to node 2. Node 2 code: power = Get next input Node 2 points to node 3. Node 3 code: hours = Get next input Node 3 points to node 4. Node 4 is the end node.
c.
Flowchart ComputeEnergyConsumed has 2 parameter variables (float power, float hours),1 return variable (float energy), and 3 nodes. Node 1 is the start node and points to node 2. Node 2 code: energy =(power * hours)/1000 Node 2 points to node 3. Node 3 is the end node.
d.
Flowchart PrintPowerConsumed has 1 parameter variable (float totalEnergyConsumed), no return variable, and 4 nodes. Node 1 is the start node and points to node 2. Node 2 code: Put totalEnergyConsumed to output Node 2 points to node 3. Node 3 puts to output a newline Node 3 points to node 4. Node 4 is the end node.

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!