Advertisement
Guest User

Untitled

a guest
Jan 27th, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. package com.company;
  2. import java.io.IOException;
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7. private static Scanner in = new Scanner(System.in);
  8.  
  9. public static void main(String[] args) {
  10.  
  11. double x = nextSafeDouble();
  12.  
  13. }
  14.  
  15. private static double nextSafeDouble()
  16. {
  17. double temp = 0;
  18.  
  19. do
  20. {
  21. try
  22. {
  23. temp = in.nextDouble();
  24. break;
  25. }
  26. catch (Exception e)
  27. {
  28. System.out.println ("Неверные данные");
  29. }
  30. } while(true);
  31.  
  32. return temp;
  33.  
  34. }
  35.  
  36. /*private static double calculate(double x, double y)
  37. {
  38. return (Math.abs(Math.sin(x) - y) + 2 * x) / (Math.sqrt(1 + Math.abs(x * y)));
  39. }*/
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement