EmiliaKitkarska

HOMEWORK1

Oct 13th, 2019
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1. ПРАВОЪГЪЛНИК
  2.  import java.util.Scanner;
  3.  
  4. class Main {
  5.   public static void main(String[] args) {
  6.     Scanner scan = new Scanner(System.in);
  7.     double a = scan.nextDouble();
  8.     System.out.println("a:"+a);
  9.     double b = scan.nextDouble();
  10.     System.out.println("b:"+b);
  11.     double P = 2*(a+b);
  12.     double S = a*b;
  13.     System.out.println("P="+P);
  14.     System.out.println("S="+S);
  15.   }
  16. }
  17.  
  18.  
  19.  
  20. 2.ТРАПЕЦ
  21. import java.util.Scanner;
  22.  
  23. class Main {
  24.   public static void main(String[] args) {
  25.     Scanner scan = new Scanner(System.in);
  26.     double a = scan.nextDouble();
  27.     System.out.println("a:"+a);
  28.     double b = scan.nextDouble();
  29.     System.out.println("b:"+b);
  30.      double h = scan.nextDouble();
  31.     System.out.println("h:"+ h);
  32.     double S = (a + b)/ 2 * h;
  33.     System.out.println("S="+S);
  34.   }
  35. }
  36.  
  37.  
  38. 3.КРЪГ
  39. import java.util.Scanner;
  40.  
  41. class Main {
  42.   public static void main(String[] args) {
  43.     Scanner scan = new Scanner(System.in);
  44.     double r = scan.nextDouble();
  45.     double C =2*3.14*r;
  46.     double S = 3.14*r*r;
  47.     System.out.println("r:"+r);
  48.     System.out.println("C="+C);
  49.     System.out.println("S="+S);
  50.   }
  51. }
  52.  
  53.  
  54. 4.ПАРИЧКИ
  55.  import java.util.Scanner;
  56.  
  57. class Main {
  58.   public static void main(String[] args) {
  59.    Scanner scanner = new Scanner(System.in);
  60.    int bit = scanner.nextInt();
  61.    double yuan = scanner.nextDouble();
  62.    double c = scanner.nextDouble()/100;
  63.    double bit_bgn = bit*1168;
  64.    double yuan_usd = yuan*0.15;
  65.    double yuan_bgn = yuan_usd * 1.76;
  66.    double euro = (bit_bgn + yuan_bgn)/1.95 - ((bit_bgn + yuan_bgn)/1.95*c);
  67.    System.out.println(euro);
  68.   }
  69. }
RAW Paste Data