Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package SimpleCalcExams;
- import java.util.Scanner;
- public class Distance {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int firstSpeed = Integer.parseInt(scanner.nextLine());
- int firstTime = Integer.parseInt(scanner.nextLine());
- int secondTime = Integer.parseInt(scanner.nextLine());
- int thirdTime = Integer.parseInt(scanner.nextLine());
- double firstDistance = 0.0166667 * firstSpeed * firstTime;
- double secondDistance = 0.0166667 * (firstSpeed + firstSpeed * 0.1) * secondTime;
- double thirdDistance = 0.0166667 * ((firstSpeed + firstSpeed * 0.1) - (firstSpeed + firstSpeed * 0.1) * 0.05) * thirdTime;
- double totalDistance = firstDistance + secondDistance + thirdDistance;
- System.out.printf("%.2f", totalDistance);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment