Професионална програма
Loading...
Tarantula83 avatar Tarantula83 3 Точки

Задача Three Brothers Помощ!

Здравейте колеги! Може ли малко помощ че вече блокирах от всякаде!Къде бъркам?

Ето го и кода ми:

import java.util.Scanner;

public class ThreeBrothers {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        double firstBrother = Double.parseDouble(scanner.nextLine());
        double secondBrother = Double.parseDouble(scanner.nextLine());
        double thirdBrother = Double.parseDouble(scanner.nextLine());
        double father = Double.parseDouble(scanner.nextLine());

        double totalTime = 1 / (1 / firstBrother + 1 / secondBrother + 1 / thirdBrother);
        double timeWhitRest = totalTime * 0.15;
        totalTime += timeWhitRest;
        double timeRemaining = father - totalTime;


        System.out.print("Clearing time: ");
        System.out.printf("%.0f",Math.floor(totalTime));
        if (timeRemaining > 0) {
            timeRemaining = Math.floor(timeRemaining);
            System.out.println("Yes, there is a surprise - time left -> {Math.Abs(Math.Ceiling( timeRemaining))} hours.");


        }else {
            System.out.printf("No, there isn't a surprise - shortage of time -> {Math.Abs(Math.Floor(timeRemaining))} hours.");
        }
        System.out.println(timeRemaining);
    }
}

Благодаря предварително!

Тагове:
0
Programming Basics
Edzhevit avatar Edzhevit 77 Точки

Просто трябва да добавиш totalTime + (totaltime * 0.15) всичко друго е точно.

https://pastebin.com/BzfWkVh6

0