Професионална програма
Loading...
+ Нов въпрос
Traio avatar Traio 1 Точки

zadacha nomer 6 s java

Kato zadam parviq vhod sichko e ok.A kato vkaram vtoriq vhod na izhoda mi dava savsem razlichno chislo kade barkam.
package exserses;

import java.util.DuplicateFormatFlagsException;
import java.util.Scanner;

public class CharityCampaign {
    public static void main(String[] args) {
        Scanner scr = new Scanner(System.in);
        Double days = Double.parseDouble(scr.nextLine());
        Double cookies = Double.parseDouble(scr.nextLine());
        Double cake = Double.parseDouble(scr.nextLine());
        Double gofretes = Double.parseDouble(scr.nextLine());
        Double pancakes = Double.parseDouble(scr.nextLine());

        double cakePrise = cake * 45;
        double gofretesPrise = gofretes * 5.80;
        double pancakesPrise = pancakes * 3.20;
        double perDeys = cakePrise + gofretesPrise + pancakesPrise;
        double prise = (cakePrise + gofretesPrise + pancakesPrise) * 8;

        double totalPrise = prise * 23;
        double endPrise = totalPrise - (totalPrise / 8);
        System.out.printf("%.02f", endPrise);
    }
}

Тагове:
0
Programming Basics
AntoanMashkov avatar AntoanMashkov 2 Точки

Надявам се че ще ти свърши работа.

 import java.util.Scanner;

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

      int days = Integer.parseInt(scanner.nextLine());
      int cooks = Integer.parseInt(scanner.nextLine());
      int cakes = Integer.parseInt(scanner.nextLine());
      int waffles = Integer.parseInt(scanner.nextLine());
      int pancakes = Integer.parseInt(scanner.nextLine());

      double cakesPrice = cakes * 45.0;
      double wafflesPrice = waffles * 5.0;
      double pancakesPrice = pancakes * 3.2;

      double sumAllCooks = (cakesPrice + wafflesPrice + pancakesPrice) * cooks;

      double  totalSum = sumAllCooks * days;
      double sunForCharity = totalSum - totalSum * 1 / 8;
      System.out.printf("%.2f", sunForCharity);

    }
}

0