advertisement

Car Racing Filename: car The Problem You are entering a race car into a race, but before you do you want to find out the average speed your driver drives the car at. Your driver will drive the car at a set speed for a certain amount of time, then switch speeds for a different amount of time. The Input You will be given an integer t (1 ≤ t ≤ 1000), the number of test cases that will follow. Each test case will start with an integer a (1 ≤ a ≤ 50), the number of sets of speed data your driver drove the car at. Each set of speed data consist of a double, the speed the driver drove at, and an int, the number of minutes the driver drove at that speed. The Output For each case output “Car #d: On average this car went at m mph.” where d is the test case number and m is the average speed, in miles per hour. Note: Print out the number of decimal places that Java naturally prints out for a double. Your answer will be considered correct if it’s within .01 mph of the actual answer. Sample Input 2 2 30.0 30 60.0 30 1 65.3 5 Sample Output Car #1: On average this car went at 45.0 mph. Car #2: On average this car went at 65.3 mph.