java吧 关注:1,247,843贴子:12,726,591
  • 0回复贴,共1

谁能帮我解答一下这个有关if, else的作业? 这是英文问题来的!

只看楼主收藏回复

The phone company used the following rate structure for calls from San Francisco to Miami, Florida back in 1995:
Any call started at or after 6:00 pm (1800) but before 8:00 am (800.) is discounted 50%.
All calls are subject to a 4% federal tax.
The regular rate is $0.40 per minute.
Any call longer than 60 minutes receives a 15% discount on its cost (after any other discount is subtracted but before tax is added).
Please do not ask me in which order the calculations are to be done. That information can be deduced from the final bullet point above.
Write a program that reads from the user the start time for a call based on a 24-hour clock and the length of the call in minutes. Both of these will be stored in int variables. The gross cost (before any discount or tax) should be printed, and then the net cost (after discounts and taxes). Turn in 4 outputs for this exercise, showing that your program works in each of the following 4 cases. Use the input examples shown here, don't make up your own.
Sample output 1:
Enter start time: 2322
Enter length of call in minutes: 67
gross cost: $26.80
net cost: $11.85
Sample output 2:
Enter start time: 759
Enter length of call in minutes: 10
gross cost: $4.00
net cost: $2.08
Sample output 3:
Enter start time: 1300
Enter length of call in minutes: 100
gross cost: $40.00
net cost: $35.36
Sample output 4:
Enter start time: 1300
Enter length of call in minutes: 10
gross cost: $4.00
net cost: $4.16


1楼2017-06-23 11:39回复