Kaid Elliott

Greenhorn
+ Follow
since Apr 12, 2019
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kaid Elliott

Rob Spoor wrote:There are three very clear errors in your code:

1) You always set the position argument to 10, so no matter what Fibonacci number you want, you would always get the same value (for position 10).
2) Your loop body always does the exact same thing. It doesn't use the loop counter, but always does the same thing, regardless of the input.
3) You always return 0.

You need to step away from a computer, and write down on paper how you would do this first.



Not to be disrespectful in any way but I wouldn't have asked if I did not already write this down on paper, search on google or read about it, can you explain with code I'm not asking you to do the work simply modify my code. I have Changed position to = 0. by the way and it and still does the same thing
4 years ago
I have written code below which does the Fibonacci Sequence the problem I am having is that when I run it against my JUnit Test code only one problem is resolved. I will show you below.

This is my glorious code.....not really.


Now this is my Unit Test code


When I run it against this only one issue is resolved, if anybody can tell me what i am doing wrong it will be greatly appreciated.
4 years ago

Piet Souris wrote:I gave an example of how to convert a two-digit array into a String, with the question how to proceed if you did not know the length of the array upfront. How about using some loop?


For this specific question I have to input a single integer not an array so converting an array into string wouldnt work. Thank You Tho
4 years ago

Campbell Ritchie wrote:MB: welcome to the Ranch

How far have you got?



well ive changed it from being an array now I am trying to convert the input without using integer.parse and instead using for loops since I cant use the previous method. I am also not sure how to have the output return as a string.
4 years ago

Piet Souris wrote:@Kaid,

if you have an array, say a{0, 1}, then "" + a[1] + a[0] would deliver the String "10". Your array might have a length that is not known beforehand, how would you tackle that problem?


Edit: assuming your problem is converting your array to a String....      



The whole issue with my method is that the question wants me to input a single integer convert it then set the output to string. my method inputs a whole array which is an easy fix the only issue I am having is 1 converting to binary without using integer.parse and instead using for loops and then having the output return a string format.
4 years ago

Stephan van Hulst wrote:

Kaid Daik wrote:also can someone tell me how to directly reply to people.


Kaid, either quote the relevant part of the post that you are replying to, or just name them in your reply, as I demonstrated in this reply.



Thanks for telling me appreciate it.
4 years ago
Yeah I have not got far to be honest I am still trying to figure it out, also can someone tell me how to directly reply to people.
4 years ago
Yes I wish I could just use that but for this question they specifically specify not use this. I have to essentially do the whole thing with loops and such.
4 years ago
The method I am trying to create is: public static String IntToBinary(int inputInt).

This essentially should take an int as a single input , convert this int to a binary version of itself (e.g. 3 becomes “11”) and output that binary number as a string.

I have written some code but it honestly doesn't do what the question says i need to do.

Any help would be greatly appreciated.

What I have tried:

//This is the only way i know how to convert an it doesn't do what i need it to do in the question as i have to insert a single integer convert it to the binary and then make it output the string the method below doesn't do this



Comment
4 years ago