Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaridis committed Sep 15, 2017
1 parent 8645dc0 commit 6fa56b3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 24 deletions.
30 changes: 30 additions & 0 deletions src/com/test/askiseis/FibonacciCalculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.test.askiseis;

public class FibonacciCalculator {
int integer;
int sum1 = 0;

FibonacciCalculator (int integer){
integer=this.integer;

}

public int fibonacciCalculator () {

int sum2 = 1;
int sum3 = 0;
int i = 0;
while (i < this.integer) {
sum1 = sum2 + sum3;
sum2 = sum3;
sum3 = sum1;

System.out.println(sum1);
i++;
}
return sum1;

}


}
2 changes: 1 addition & 1 deletion src/com/test/askiseis/FibonacciSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.Scanner;

public class FibonacciSequence extends MainProgram {
public class FibonacciSequence {

public FibonacciSequence ()

Expand Down
6 changes: 1 addition & 5 deletions src/com/test/askiseis/IntegerChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ public class IntegerChecker {

public IntegerChecker (int intnum) {
int result = (intnum % 2);
if (result == 0) {
ret = true;
} else {
ret = false;
}
ret = result == 0;
}

public boolean isRet () {
Expand Down
27 changes: 9 additions & 18 deletions src/com/test/askiseis/MainProgram.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ public class MainProgram {
public static void main ( String[] args ) {

int input = 0;
float input2 = 0;
float result = 0;
int i = 0;
float nnumber;

do {
Expand Down Expand Up @@ -79,21 +76,15 @@ public static void main ( String[] args ) {
IntegerDivisors intdiv = new IntegerDivisors ( integer );
break;

case 7:
System.out.println ( "Please define the number of repeats" );
int number = scan.nextInt ();
float sum2 = 1;
float sum3 = 0;
i = 0;
while (i < number) {
float sum1 = sum2 + sum3;
sum2 = sum3;
sum3 = sum1;

System.out.println ( sum1 );
i++;
}
case 7: //FibonacciCalculator NOT WORKING
System.out.println ( "7 Selected" );
System.out.println ( "Implement a Java program that calculates the Fibonacci sequence" );
System.out.println ( "Please give us the number of repeats" );
integer = scan.nextInt ();
FibonacciCalculator fibcalc = new FibonacciCalculator(integer);
System.out.println(fibcalc.sum1);
break;

case 17:
FibonacciSequence fib = new FibonacciSequence ();
break;
Expand All @@ -103,7 +94,7 @@ public static void main ( String[] args ) {
break;
case 20:
System.out.println ( "Please give us a number" );
number = scan.nextInt ();
int number = scan.nextInt ();
Askisi5 ask5 = new Askisi5 ( number );
System.out.println ( "The number of digits is: " + ask5.getLength () );
break;
Expand Down

0 comments on commit 6fa56b3

Please sign in to comment.