Exercise: Teleport price The cargo teleporter from Earth to Mars operates betwee
ID: 3852262 • Letter: E
Question
Exercise: Teleport price
The cargo teleporter from Earth to Mars operates between 3 am and 11 am every day. Write a program that computes the price of sending cargo at a particular time. The price per kilo changes every hour. Teleports from Earth to Mars have different prices than teleports from Mars to Earth.
Here’s a sample:
The user enters the time of the transport, kilos, and whether the destination is Earth or Mars. The program computes the price. The PPK (price per kilo) table is shown.
You can assume that users don’t make any typing mistakes.
Hint: Time is entered as hour, then a space, then minutes. Use the InStr function to find the space. The characters to the left of that give you the hour.
Upload your spreadsheet.
1 Earth-Mars Teleport Price 3 When: 710 5 Eg., 10 15 7 Kilos: 2 9 Destination: 10 E or M Compute 12 13 14 Price: 15 16 17 18 836 E to M M to E 3 to 3:59 4 to 4:59 5 to 5:59 6 to 6:59 7 to 7:59 8 to 8:59 9 to 9:59 10 to 11 312 349 401 358 393 418 387 362 21 433 390Explanation / Answer
We can't upload spreadsheet documents in this website. We can only upload text and image files.
So, here I'm giving you complete details on you can obtain the 'hour' part from the cell.
Hour is on the left of the space.
So, we can do this using the Left() function along with InStr() function.
Consider the following formula:
Expr1:Left([Time],(InStr(1,[Time]," "))-1)
So we get the hour using this formula.
This is the best I can do for you since uploading spreadsheet is not possible in the website. Thank you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.