Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pb1;
- import java.util.Scanner;
- public class Wednesday2 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int kmDistance = Integer.parseInt(scanner.nextLine());
- int razhodLit = Integer.parseInt(scanner.nextLine());
- double dizelLit = Double.parseDouble(scanner.nextLine());
- int sum = Integer.parseInt(scanner.nextLine());
- int razhodKola = (kmDistance * razhodLit) / 100;
- double wholeRazhod = razhodKola * dizelLit;
- double nalichni = wholeRazhod - sum;
- if (nalichni >= wholeRazhod) {
- System.out.printf("You can take a trip. %.2f money left.", nalichni);
- } else if (nalichni < wholeRazhod) {
- System.out.printf("Sorry, you cannot take a trip. Each will receive %.2f money.", nalichni / 4);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement