Задачата Alkohol Market Java!
Здравейте колеги!!!
Някои може ли да каже какво не е наред при първия вход изхода е верен при втория не е !!!
Формулите изглеждат верни от къде идва проблема ? Ето го и кода ми!
import java.util.Scanner; public class AlcoholMarket { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double priceOfWhiskeyInBGN = Double.parseDouble(scanner.nextLine()); double amountOfBeerInLiters = Double.parseDouble(scanner.nextLine()); double amountOfWineInLiters = Double.parseDouble(scanner.nextLine()); double amountOfBrandiesInLiters = Double.parseDouble(scanner.nextLine()); double amountOfWhiskeyInLiters = Double.parseDouble(scanner.nextLine()); double priceOfBrandies = 25; double priceOfWine = priceOfBrandies - (0.4 * priceOfBrandies); double priceOfBeer = priceOfBrandies - (0.8 * priceOfBrandies); double amountForBrandies = amountOfBrandiesInLiters * 25; double amountForWine = amountOfWineInLiters * priceOfWine; double amountForBeer = amountOfBeerInLiters * priceOfBeer; double amountForWhiskey = amountOfWhiskeyInLiters * priceOfWhiskeyInBGN; double total = amountForBrandies + amountForWine + amountForBeer + amountForWhiskey; System.out.printf("%.2f",total); } }
Благодаря предварително!
Да стана Мерси!!! Просто съм пропуснал да прочета че цената на ракията не е фиксирата а е наполвина от цената на уискито!