Question: java programming 4. We need to write a general program for a research center. This application is used to calculate the time for the vehicle
4. We need to write a general program for a research center. This application is used to calculate the time for the vehicle running 1000Km. All we know are: (10) 1. Each vehicle has three parameters: A, B, C and for different vehicles, the speed calculations are different based on these parameters. a) Car: speed =AB/C; b) Plane: speed =A+B+C 2. Provide an interface Common : which defines a method speed to calculate the speed for different vehicle; which defines a method costTime to calculate the time for this vehicle running a different distance. public interface Common \{ double speed (double a, double b, double c); double costTime(double speed, double distance); ) Q1: Create two classes Car and Plane which implement the interface Common. In these classes, we should have some attributes, e.g., speed, name, and so on. (7(4+4+4)) Q2: Write a test program vehicleTest to test your two classes to calculate the speed and the time, Sample for input format \& output formats: (3') vehicleTest Car 120602 The speed of the vehicle Car is: 90km/s The time for running 1000Km is: 11.11 hours. vehicleTest Plane 100200200 The speed of the vehicle Plance is: 500km/s The time for running 1000Km is: 2 hours
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
