Package exercise1

Examples of exercise1.ImprovedFibonacci


    int hi = 1;
    String mark;
    FibonacciElement[] elements = new FibonacciElement[MAX_INDEX];
   
    for(int i = 0; i < MAX_INDEX; i++) {
      elements[i] = new FibonacciElement(hi);
      hi = lo + hi;
      lo = hi - lo;
    }
   
    String[] outputWords = new String[MAX_INDEX];
    for(int i = 0; i < MAX_INDEX; i++) {
      FibonacciElement element = elements[i];
      if(element.isEven()) {
        mark = " *";
      } else {
        mark = "";
      }
      outputWords[i] = i + 1 + ": " + element.getNumber() + mark;
    }
   
    for(String word : outputWords) {
      System.out.printf("%s%n", word);
    }
View Full Code Here


    int hi = 1;
    String mark;
    FibonacciElement[] elements = new FibonacciElement[MAX_INDEX];
   
    for(int i = 0; i < MAX_INDEX; i++) {
      elements[i] = new FibonacciElement(hi);
      hi = lo + hi;
      lo = hi - lo;
    }
   
    String[] outputWords = new String[MAX_INDEX];
    for(int i = 0; i < MAX_INDEX; i++) {
      FibonacciElement element = elements[i];
      if(element.isEven()) {
        mark = " *";
      } else {
        mark = "";
      }
      outputWords[i] = i + 1 + ": " + element.getNumber() + mark;
    }
   
    for(String word : outputWords) {
      System.out.println(word);
    }
View Full Code Here

TOP

Related Classes of exercise1.ImprovedFibonacci

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.