keymasterviriya1150

Untitled

Nov 29th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.72 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3. import java.math.BigInteger;
  4.  
  5. class man {
  6.  
  7.     public static void main(String[] args) {
  8.         number a = new number();
  9.         Hightnumber h = new Hightnumber();
  10.         h.maxnumber(h.max());
  11.         h.roundFibonacci(h.round());
  12.  
  13.     }
  14.  
  15. }
  16.  
  17. class number extends printfuck implements prototypenumber
  18. {
  19.  
  20.  
  21.     @Override
  22.     public BigInteger input() {
  23.  
  24.         Scanner in = new Scanner(System.in);
  25.         p("Input Number: ");
  26.         BigInteger number = BigInteger.valueOf(0);
  27.         number = in.nextBigInteger();
  28.         return number;
  29.  
  30.     }
  31.  
  32.     @Override
  33.     public BigInteger frist() {
  34.         BigInteger frist = input();
  35.         return frist;
  36.  
  37.     }
  38.  
  39.     public BigInteger two() {
  40.         BigInteger two = input();
  41.         return two;
  42.  
  43.     }
  44.  
  45. }
  46.  
  47. class Hightnumber extends printfuck implements prototypeworking {
  48.  
  49.     @Override
  50.     public BigInteger max() {
  51.         Scanner in = new Scanner(System.in);
  52.         System.out.print("Max Fibonacci : ");
  53.         BigInteger maxi = in.nextBigInteger();
  54.         return maxi;
  55.  
  56.     }
  57.     @Override
  58.     public void maxnumber(BigInteger maxi) {
  59.         number n = new number();
  60.         BigInteger One = n.frist();
  61.         BigInteger Two = n.two();
  62.         p(" " + One + "\n" + " " + Two + "\n" + "\n+==================+\n");
  63.         BigInteger three;
  64.         long count = 0;
  65.         while (true) {
  66.             three = One.add(Two);
  67.             One = Two;
  68.             Two = three;
  69.             int res = 0;
  70.             res = three.compareTo(maxi);
  71.             if (res == 1) {
  72.                 break;
  73.             }
  74.             p(" " + three + "\n");
  75.             count++;
  76.         }
  77.         p("round number: " + (count + 2)+"\n");
  78.  
  79.     }
  80.  
  81.     public long round() {
  82.         Scanner in = new Scanner(System.in);
  83.         p("Round Fibonacci : ");
  84.         long round = in.nextLong();
  85.         return round;
  86.     }
  87.  
  88.     public void roundFibonacci(long round) {
  89.         number n = new number();
  90.         BigInteger One = n.frist();
  91.         BigInteger Two = n.two();
  92.         p(" " + One + "\n" + " " + Two + "\n" + "\n" + "+==================+\n");
  93.         BigInteger three;
  94.         long count = 0;
  95.         for (int i = 0; i < round; i++) {
  96.             three = One.add(Two);
  97.             One = Two;
  98.             Two = three;
  99.             p(" " + three + "\n");
  100.         }
  101.     }
  102.  
  103.    
  104. }
  105.  
  106. class printfuck {
  107.     static void p(String s) {
  108.         System.out.print(s);
  109.     }
  110. }
  111.  
  112. interface prototypeworking
  113. {
  114.     public Object max();
  115.     public void maxnumber(BigInteger thisBigInteger);
  116. }
  117. interface prototypenumber
  118. {
  119.     public Object input();
  120.     public Object frist();
  121.     public Object two();
  122.    
  123.            
  124. }
Advertisement
Add Comment
Please, Sign In to add comment