s*********0 发帖数: 41 | 1 The manager of PG&E wants a program that calculates a customer's electric
bill. He will enter the current and previous meter readings. The program
should calculate and display the number of units of electricity used and the
total charge for the electricity. The charge for each unit of electricity
is $0.11. The program allows the user to display the electric bill for more
than one customer without having to run the program again. Use a sentinel
value to end the program.
Create 3 functions:
getInput: Gets the current and previous meter readings from the user. If
the user does not enter a sentinel value as the current reading, the
getInput function should prompt the user to enter the previous reading. To
be valid, the current reading must be greater than or equal to the previous
reading. The main function should not call the calcBill or displayBill
functions when the readings are not valid. Instead, it should display an
error message.
calcBill: Calculates both the number of units used and the total charge.
displayBill: Displays both the number of units used and the total charge.
Input Validation: Do not accept negative numbers for meter readings.
Sample run:
Current reading (negative number to end): 4000
Previous reading: 1000
Units used: 3000
Total charge: $330.00
Current reading (negative number to end): 4000
Previous reading: 5000
The current reading must be greater than or equal to the previous reading. |
L*****e 发帖数: 8347 | 2 你是哪部分有问题问?还是说要找人把完整code写出来你拿去交?
the
more
If
【在 s*********0 的大作中提到】 : The manager of PG&E wants a program that calculates a customer's electric : bill. He will enter the current and previous meter readings. The program : should calculate and display the number of units of electricity used and the : total charge for the electricity. The charge for each unit of electricity : is $0.11. The program allows the user to display the electric bill for more : than one customer without having to run the program again. Use a sentinel : value to end the program. : Create 3 functions: : getInput: Gets the current and previous meter readings from the user. If : the user does not enter a sentinel value as the current reading, the
|
z****0 发帖数: 4413 | 3 500刀 肯定有人给你做
the
more
If
【在 s*********0 的大作中提到】 : The manager of PG&E wants a program that calculates a customer's electric : bill. He will enter the current and previous meter readings. The program : should calculate and display the number of units of electricity used and the : total charge for the electricity. The charge for each unit of electricity : is $0.11. The program allows the user to display the electric bill for more : than one customer without having to run the program again. Use a sentinel : value to end the program. : Create 3 functions: : getInput: Gets the current and previous meter readings from the user. If : the user does not enter a sentinel value as the current reading, the
|
L*****e 发帖数: 8347 | 4 100我就做。。。
【在 z****0 的大作中提到】 : 500刀 肯定有人给你做 : : the : more : If
|
m******d 发帖数: 75 | |
f*******l 发帖数: 964 | |
j********8 发帖数: 136 | 7 这么简单的
the
more
If
【在 s*********0 的大作中提到】 : The manager of PG&E wants a program that calculates a customer's electric : bill. He will enter the current and previous meter readings. The program : should calculate and display the number of units of electricity used and the : total charge for the electricity. The charge for each unit of electricity : is $0.11. The program allows the user to display the electric bill for more : than one customer without having to run the program again. Use a sentinel : value to end the program. : Create 3 functions: : getInput: Gets the current and previous meter readings from the user. If : the user does not enter a sentinel value as the current reading, the
|
t******0 发帖数: 14 | |
s******c 发帖数: 1920 | 9 lz奔一个 马上就有人写了
the
more
If
【在 s*********0 的大作中提到】 : The manager of PG&E wants a program that calculates a customer's electric : bill. He will enter the current and previous meter readings. The program : should calculate and display the number of units of electricity used and the : total charge for the electricity. The charge for each unit of electricity : is $0.11. The program allows the user to display the electric bill for more : than one customer without having to run the program again. Use a sentinel : value to end the program. : Create 3 functions: : getInput: Gets the current and previous meter readings from the user. If : the user does not enter a sentinel value as the current reading, the
|
s*********0 发帖数: 41 | 10 你先写一点,我奔一个上半身
【在 s******c 的大作中提到】 : lz奔一个 马上就有人写了 : : the : more : If
|