Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would i write this in an if else statement to return the correct values? C:

ID: 3651594 • Letter: H

Question

How would i write this in an if else statement to return the correct values?
C: $60.00 for the first 1000 kwh and $0.045 for each additional kwh
I: rate varies depending on time of usage:
Peak hours: $76.00 for first 1000 kwh and $0.065 for each additional kwh
Off-peak hours $40.00 for first 1000 kwh and $0.028 for each additional kwh.

Explanation / Answer

for C: float cost = 60; if(kwh>1000) cost = cost + (kwh-1000)*0.045; for I: for peak hours - float cost = 76; if(kwh>1000) cost = cost + (kwh-1000)*0.065; off peak - float cost = 40; if(kwh>1000) cost = cost + (kwh-1000)*0.028;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote