soneand pap

Ranch Hand
+ Follow
since Nov 13, 2018
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by soneand pap

also a stupid question is "package" necessary in every program??
i am asking because until now i have never write the word "package" in my exercises!
3 years ago
thanks for the post.
i just couldn't find out how to use split and the integer part in Java..i thought i had to create 2 methods separately and thats where i was confused..
In Python the things are easier and i thought if i wrote it in Python I could change it back to java.

i was confused with that:

String[] macPart = macAddr.split(":");

somehow it wasnt working and i was getting mad..really mad

3 years ago
well,my python code is this one:
def hex_string_to_dec(s):
   total = 0
   value = 1
   for i in range(len(s)-1, -1, -1):
       if s[i] >= '0' and s[i] <= '9':
           total += int(s[i])*value
       elif s[i] >= 'A' and s[i] <= 'F':
           total += (ord(s[i])-ord('A')+10)*value
       elif s[i] >= 'a' and s[i] <= 'f':
           total += (ord(s[i])-ord('a')+10)*value    
       value *= 16

macaddr = input("write your MAC address in  x:x:x:x:x:x  : ")
s1, s2, s3, s4, s5, s6 = macaddr.split(":")

if hex_string_to_dec(s1) == hex_string_to_dec(s2) == hex_string_to_dec(s3) == \
  hex_string_to_dec(s4) == hex_string_to_dec(s5) ==hex_string_to_dec(s6) == 255:
   print('this mac is broadcast ... ')
elif hex_string_to_dec(s1) % 2 == 0:
   print('this mac is unicast ... ')
elif hex_string_to_dec(s1) % 2 == 1:
   print('this mac is multicast ... ')

how am i supposed to convert to java?

3 years ago

salvin francis wrote:Hi soneand,
I just browsed through this entire thread and I see that you haven't posted any code. Most of your posts are complaining about x did not work and y did not work, but there is actually no code posted.

soneand pap wrote:I solved this exercise in Python.

Again ... No python code posted. Please post that so that we can help check that.

soneand pap wrote: Is there a way to convert Python to Java?

Why do you want to do that ? Your requirements hardly span 10 lines of code.

1.i havent posted anything because its wrong and you gonna mock me.thats why i am avoiding it
2.Lets say i upload here the Python code.if there is no way to convert it to java whats the point?
3.10 lines only??No way!!its at least 70 lines

but wait i will write my python
3 years ago
Last question... As you can see I am not suited for Java. I solved this exercise in Python. Is there a way to convert Python to Java?
Since I can't solve it using Java?
3 years ago
no more convicing to try??
i am so pissed right now ..not a simple println message is working
3 years ago
nope its not working.
i am quitting
3 years ago

Jay Rex wrote:The video I linked to also explains what a broadcast mac address looks like.

The requirement is easier now. So now you have one extra condition to deal with.

Take each step I wrote above and write one line of code that tackles that step.

Then ask a specific question about what you don't understand.

This is a good task, and you will learn much.

can i write here later the code for ecvery step and help me make it a complete program???
3 years ago
the exercise changed again because of students complaints..
Now we dont have random Mac addresses but the user gives one and he added one more type in Mac address :broadcast..and the exercise says that:if the user gives mac address "FF:FF:FF:FF:FF:FF" then its broadcast.
i understand that for the other types i must do all the other things you wrote (string - array-split-integer etc) i must do the same for the Broadcast??

if i cant solve it,i will just write the way of how the program should work....
3 years ago

Jay Rex wrote:

You definitely can do this

well,i cant!
i dont understand how to put them together!!!

i somehow understand what i must do.I know the steps..i can somehow write write each step separately but not together!

Everyone says this exercise is simple but its not
3 years ago

Jay Rex wrote:I am a beginner like yourself. I'm six months into my journey with Java.

I experienced exactly the same thing you did. The first few tasks were a breeze and then they asked us to write a program that takes any number from 0.00 to 9999.99 and print out the English word equivalent of what that number is.

I raged for two solid weeks on this one task, but eventually I solved it.

What I can say is that I learnt more from that one task than any other task to date.

System.out.println(whatYouWantToSee) is your best friend right now.

You need to be able to see what your code does. When it shows the right result, then you know you are on the right track. Then write one more line of code and do the same thing again.

Try and try and try again. You can do this

I am happy that you did it but we are not the same.
i will try again tomoorow and i know that it wont take me 2 hours as you people say
Well,its obvious that for you the solution is simple but i can't do it by myself.Sorry for that!
3 years ago

Campbell Ritchie wrote:I still disagree. Complete this exercise, and then quit. That way you can tell whomever you ask for a job or course that you passed but weren't happy with the course.

And if you followed my hints, you could have yout program print 18 in a few minutes.

well,i cant complete it ...and why its"18" all the time??
sure you gave me the hints but if i dont have someone to explain it to me why i am doing what i do then its a waste of time. My previous exercises were not so difficult and i could solve them without help.
In this one i feel i dont get what i am doing..i understans what i must do but i cant do it.
3 years ago

Campbell Ritchie wrote:You were so near but so far here, yesterday. Did you actually run your code? You would have got an output of "18:FA:05:11". I referred you to String#split() where it showed you a regex to split "boo:and:foo" and yu copied it incorrectly; Carey told you what the error is. If you correct that, you can have that bit of code working in two minutes.
But we cannot show you the complete working code otherwise that would constitute doing your work for you.

if i copied incorrectly that means i dont understand what i am reading/doing.
Carey told me that i must convert string[0] to integer and that is difficult for me since i dont understand the way to do it.

That's why i am telling you i should quit..if i cant solve this "simple" exercise its better to put an end in my life
3 years ago

Campbell Ritchie wrote:

soneand pap wrote:i have 2 more days to solve this exercise..

You can do it in two hours if you find all the hints I gave you.

i have all the hints you gave me (i think) but i can't put them together!Its frustrating!

3 years ago
i have 2 more days to solve this exercise..Until now i cant and i wont solve it..its very confusing to me so i decided to quit this lesson.
Sorry for the time you guys spend in this thread.

since i cant find someone to help me i just will fail..

i know that you want to hepl sending all these links etc but still i can't put them all together.
3 years ago