java - Necklace Application -


i created necklace class static method determines how many numbers necklace sequence must generate return original 2 numbers. method called howlong takes parameters first 2 items in sequence. generates necklace sequence , return how many numbers must generated return original 2 numbers. did not count first 2 numbers in total did count them final time generated. can see code below printing in howlong method system.out.print(two + " ");, should not print anything. should use main method calls howlong , prints results. how can it?

import java.util.scanner; public class necklace {     public static int howlong (int firststarting, int secondstarting) {          int sum = 0;         int temp;         int 1 = firststarting;         int 2 = secondstarting;          do{             temp = (one + two) % 10;             1 = two;             2 = temp;             system.out.print(two + " ");         }while (two != secondstarting || 1 != firststarting);          return (sum);     }     public static void main (final string[] args) {          int total;         int first;         int sec;          scanner in = new scanner (system.in);         system.out.print("enter first starting number: ");         first = in.nextint();          system.out.print("enter second starting number: ");         sec = in.nextint();          total = howlong (first, sec);     }    } 


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -