March 5, 2005
     

Program / Task Name:

   St. Bernard vs T-3

Level:

 

 Novice / Advanced

Point Value:

 

 8

Solution(s):

 

 prob07.c

Data File(s):

 

 

 
C programmers: your program name must be: prob07.exe
JAVA programmers: your program name must be: prob07.class

 

Task Description

You’re a busy IT professional at a big, multi-national corporation.  Every day, employees need to transfer large data files from one office location to another.  Your job is to make sure the data gets to its intended destination as quickly as possible.

The company has three methods to send large data files.  First, a trained St. Bernard named “Tiny” can carry three DLT tape cartridges (capacity of 200 Gigabytes each).  He can travel at a rate of 4 miles/hour directly to other company buildings.  Second, the company has a high speed T-3 link to the Internet, which can transfer data at 45 Mega-bits per second.  Lastly, you have an open account with FedEx, and can send a box full of DLT tapes (as many as needed) that will arrive anywhere in the world at 10:30am the day after it ships.

Since you need to make the right decision every time someone brings you data to transfer, you decide to write a program which will calculate the fastest way to transfer the data, and will tell you when the transfer will be complete (so you can keep those pesky employees from bothering you all day)

Assume that all data transfer requests will come to you at hour increments (always at the top of the hour), and that any package sent via FedEx will arrive at exactly 10:30am the following day.  Also assume that the T-3 link never fails (you have a very good service contract), and that Tiny and the T3 is ready to go as soon as the data is received.  Assume Tiny will faithfully travel back and forth without rest as long as is necessary, (he’s a very good dog).  FedEx will pick up at 1800 hours, anything not ready by 1800 will have to wait until tomorrow’s pickup time.

Note that offices over 3000 miles away should be considered to be overseas, and Tiny can’t swim across the ocean.  And for this exercise, assume a MB is one million bytes, and a GB is one billion bytes (eight bits per byte).

 

Program Input

Your program must prompt for the size of the data to transfer (in MB), and the distance (in miles) to the destination building, and the time of the data will be ready to send (in 24 hour military time:  0400 is 4am, 1300 is 1:00pm, etc.).

Enter size of transfer in megabytes: 600000

Enter distance to the destination in miles: 1000

Enter time data will be ready to send as HHMM: 1800

Hint – remember that Tiny can make multiple trips, but he has to travel back to the office first…

Program Output

Your program must output the method used to transfer the data, (by Tiny, by T-3, or by FedEx) and the time and day at which the transfer will be completed (rounded to the next half-hour).

 

Sample Program Execution:

Enter size of transfer in megabytes: 600000

Enter distance to the destination in miles: 10

Enter time data will be ready to send as HHMM: 1800

Shipment by Tiny will arrive at 2030 hours today

 

Enter size of transfer in megabytes: 600000

Enter distance to the destination in miles: 1000

Enter time data will be ready to send as HHMM: 1800

Shipment by FexEx will arrive at 1030 hours tomorrow

 

Enter size of transfer in megabytes: 600000

Enter distance to the destination in miles: 1000

Enter time data will be ready to send as HHMM: 1900

Shipment by T3 will arrive at 0100 hours 2 days from today

 

 

   
  (c) 2005 Hewlett-Packard Company