Advertisement
BetinaUKTC

kaufland

Jan 4th, 2020
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.54 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Scanner;
  3.  
  4. public class Program {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in);
  8.         int wines = 300;
  9.         int beers = 200;
  10.         int wD = 0;
  11.         int wO = 0;
  12.         int bD = 0;
  13.         int bO = 0;
  14.         while (true) {
  15.             String[] input = scan.nextLine().split(": ");
  16.             if (input[0].equalsIgnoreCase("end")) {
  17.                 break;
  18.             }
  19.             if (input[0].equals("Beers")) {
  20.                 int q = Integer.parseInt(input[1]);
  21.                 beers += q;
  22.                 if (q > 0) {
  23.                     bD++;
  24.                 } else if (q < 0) {
  25.                     bO++;
  26.                 }
  27.             }else if (input[0].equals("Wines")) {
  28.                 int q = Integer.parseInt(input[1]);
  29.                 wines += q;
  30.                 if (q > 0) {
  31.                     wD++;
  32.                 } else if (q < 0) {
  33.                     wO++;
  34.                 }
  35.             }
  36.         }
  37.         System.out.println("Beers: " + beers);
  38.         System.out.println("Beers orders: " + bO);
  39.         System.out.println("Beers deliveries: " + bD);
  40.         System.out.println("Wines: " + wines);
  41.         System.out.println("Wines orders: " + wO);
  42.         System.out.println("Wines deliveries: " + wD);
  43.     }
  44.  
  45. }
  46.  
  47. import java.util.ArrayList;
  48. import java.util.Scanner;
  49.  
  50. public class main {
  51.  
  52.     public static void main(String[] args) {
  53.  
  54.         Scanner scan = new Scanner(System.in);
  55.         String[]input = scan.nextLine().split(",");
  56.         double r1 = Double.parseDouble(input[0]);
  57.         double h1 = Double.parseDouble(input[1]);
  58.         double r2 = Double.parseDouble(input[2]);
  59.         double h2 = Double.parseDouble(input[3]);
  60.         double v1 = 3.14159265359* (r1*r1) *h1/1000;
  61.         double v2 = 3.14159265359* (r2*r2) *h2/1000;
  62.         System.out.printf("%.2f",Math.max(v1,v2));
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement