Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

5th grade math

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if a=1 and z=26 what does:
Methionylglutaminylarginyltyrosylglutamylserylleucylphen-
ylalanylalanylglutaminylleucyllysylglutamylarginyllysylgluta-
mylglysylalanylphenylalanylvalylprolylphenylalanylyalylthre-
onylleucylglcycylaspartylprolylglicylisoleucyglutamylgluta-
minlserylleucyllysylisoleucylaspartylthreonylleucylisoleu-
cylglutamylalanylglyclyalanylaspartylalanylleucyglutamylle-
ucylgluycylisoleucylproluylphenylalanyserylaspartyprolylleu-
celalanylaspartylglycylprolylthreonylisolleucyglutaminylaspa-
raginylalanythreonylleucylarginylalanylphenylalanylalanylal-
anylglycylvalylthreonylprolylalanylglutaminylcysteinylphen-
ylalanylglglutamylmethionylleucyalanylleucylisoleucylarginyl-
glutaminyllysylhistidylprolyuthreonylisoleucylprolylisoleuc-
ylglycylleucylleucylmethionyltyrosylalanylasbaraginylleucyl-
valylphenylalanylsparaginyyllysylglycylisoleucylaspartylglut-
amylphenylalanylyltyrosylalanylglutaminylcysteinylglutamyll-
ysylvalylglycylvalylspartylserylvalylleucylvallalanylaspart-
ylvalylprolylvalvlglutaminylglutamylserylalanylprolylpheny-
lalalrginylglutaminylalanylalanylleucylarginylhistidylasp-
araginylvalylalalprolylisoleucylphenylalanylisoleucylcystei-
nylprolyprolylaspartylalanylaspartylaspartyspartyleucylle-
ucylarginylglutaminylisoleucylalanylseryltyroslglycylargin-
ylglycyltyrosylthreonyltyrosylleucylleucylserylarginlalanyl-
glycylvalylthreonylglycylalanylglutamylasparaginylarginyla-
nylalanylleucylprolylleucylaspaaginylhistidylleucylvalylalan-
yllysylleucyllysylglutamyltyrosylasparagimylalanylalanypro-
lylprolylleucylglutaminylglycylphenlalanylglycylisoleyucyls-
erylalanylprolylaspartylglutaminylvalyllysylalanylalanylisol-
eucylalspartylalanylglycylalanylalanylglycylalanylasoleucylse-
rylglycylserylalanylisoleucylbalyllysylisoleucylisoleucylgluta-
mylglutaminylhistidylasparaginylisoleucylglutamylpronylglu-0
tamyllysylmethionylluecylalanylalanyoeucyllysylvalylpheny-
lalanylvalylglutamilylprolylmethionyllysylalanylalanylthreo-
nylarginylserine. = if added up???
 
stara szkapa
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sure Rain Man would know.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
25680
[ September 11, 2003: Message edited by: Thomas Paul ]
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange... I got 25693
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I ran it the first time I didn't notice that they had a capital letter in their sample. Of course, the "spec" only refers to lower case characters in the sample ("a=1, z=26") so the actual answer isn't quite clear.
Here's my version which is vastly superior to yours:

[ September 11, 2003: Message edited by: Thomas Paul ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Thomas Paul:

Here's my version which is vastly superior to yours:
[ September 11, 2003: Message edited by: Thomas Paul ]

Well, good for you
1. You code is good But not Reusable.
2. you did not realize the mistake (you can argue that Caps are not defined in spec - Which you probably are doing the same at your work hehe) untill the other guy did it correct.
Overall you need an improvement in your OO Basics
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True about the capital letter, but since capitals are valued 32 lss than their lowercase counterparts, I would have expected you to get 25661 (which is what I get when I remove the lower-case enforcement). I'm still wondering about your original answer, but I'm not going to lose any sleep over it.
BTW, did you know that you misspelled "inferior?"
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey! you changed your first answer from 25679 to 25680! I still don't see how you got that; running your code on my machine results in 25693 -- the answer I got.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting 25645.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Programming Diversions. Yeah, definitely moving to Programming Diversions. Eight minutes to Wapner. Eight minutes to Wapner.
[ September 11, 2003: Message edited by: Jason Menard ]
[ September 27, 2003: Message edited by: Marilyn de Queiroz ]
 
A. Levi
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe your Answer: 25693 is correct. my 5 cents.

[ September 11, 2003: Message edited by: Levi Allam ]
 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, its 25693.I copied that string hurriedly.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. You code is good But not Reusable.
I was aked to give a number not code.
2. you did not realize the mistake (you can argue that Caps are not defined in spec - Which you probably are doing the same at your work hehe) untill the other guy did it correct.
Actually I realized my mistake immediately but the server crashed and was down for 7 hours before I could correct it.
But there is still a debate. How should we treat a capital "M"? Should it be treated that same as a lower case "m". If you think so, why?
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is an interesting defect with the "convert the char to int" method. What if we randomize the values of the letters? a=6, b=11, c=2, d=18, etc.
My method works easily by changing the order of the letters in the value array. So there.
[ September 11, 2003: Message edited by: Thomas Paul ]
 
Bhau Mhatre
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by <azra>:
if a=1 and z=26 what does:
Methionylglutaminylarginyltyrosylglutamylserylleucylphen-
ylalanylalanylglutaminylleucyllysylglutamylarginyllysylgluta-
mylglysylalanylphenylalanylvalylprolylphenylalanylyalylthre-
onylleucylglcycylaspartylprolylglicylisoleucyglutamylgluta-
minlserylleucyllysylisoleucylaspartylthreonylleucylisoleu-
cylglutamylalanylglyclyalanylaspartylalanylleucyglutamylle-
ucylgluycylisoleucylproluylphenylalanyserylaspartyprolylleu-
celalanylaspartylglycylprolylthreonylisolleucyglutaminylaspa-
raginylalanythreonylleucylarginylalanylphenylalanylalanylal-
anylglycylvalylthreonylprolylalanylglutaminylcysteinylphen-
ylalanylglglutamylmethionylleucyalanylleucylisoleucylarginyl-
glutaminyllysylhistidylprolyuthreonylisoleucylprolylisoleuc-
ylglycylleucylleucylmethionyltyrosylalanylasbaraginylleucyl-
valylphenylalanylsparaginyyllysylglycylisoleucylaspartylglut-
amylphenylalanylyltyrosylalanylglutaminylcysteinylglutamyll-
ysylvalylglycylvalylspartylserylvalylleucylvallalanylaspart-
ylvalylprolylvalvlglutaminylglutamylserylalanylprolylpheny-
lalalrginylglutaminylalanylalanylleucylarginylhistidylasp-
araginylvalylalalprolylisoleucylphenylalanylisoleucylcystei-
nylprolyprolylaspartylalanylaspartylaspartyspartyleucylle-
ucylarginylglutaminylisoleucylalanylseryltyroslglycylargin-
ylglycyltyrosylthreonyltyrosylleucylleucylserylarginlalanyl-
glycylvalylthreonylglycylalanylglutamylasparaginylarginyla-
nylalanylleucylprolylleucylaspaaginylhistidylleucylvalylalan-
yllysylleucyllysylglutamyltyrosylasparagimylalanylalanypro-
lylprolylleucylglutaminylglycylphenlalanylglycylisoleyucyls-
erylalanylprolylaspartylglutaminylvalyllysylalanylalanylisol-
eucylalspartylalanylglycylalanylalanylglycylalanylasoleucylse-
rylglycylserylalanylisoleucylbalyllysylisoleucylisoleucylgluta-
mylglutaminylhistidylasparaginylisoleucylglutamylpronylglu-0
tamyllysylmethionylluecylalanylalanyoeucyllysylvalylpheny-
lalanylvalylglutamilylprolylmethionyllysylalanylalanylthreo-
nylarginylserine. = if added up???

First of all, is this a 5th grade Math?
Second, you said a=1 and z=26, but did not specify whether az=126 or az=27
Third, it looks like a organic chemistry stuff more then 5th grader math-
Methionyl glutaminyl arginyl tyrosyl glutamyl seryl leucyl phenyl ...
Fourth, you all java coders got it all wrong. I see a minus sign between the lines
Methionylglutaminylarginyltyrosylglutamylserylleucylphen-
ylalanylalanylglutaminylleucyllysylglutamylarginyllysylgluta-
...
not a plus sign. So why do yo'll add it up?
aaa-
bbb
should be 111-222 == -111 or
atleast 3-6=-3 but not 9.
 
Leslie Chaim
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TIMTOWTDI
 
Leslie Chaim
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or per line:

Of course if you only care about the answer you wrap the print statement in an END { BLOCK }

And I will take advantage of Thomas's arguments -- It does give the answer!
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[LC]: TIMTOWTDI
Welcome back, Leslie.
[ September 25, 2003: Message edited by: Jim Yingst ]
 
Leslie Chaim
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Yingst:
[LC]: TIMTOWTDI
Welcome back, Leslie.

Thanks JRY,
Yes, it has been a while as you will see here.
Too busy at work and once I do make it to the barn I just have so much catch-up to do.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it has been a while as you will see here.
Oh, I meant even longer than that. "TIMTOWTDI" seems to signal the return of the perlmonger we know and love. Tell, me, how did you regain control from the imposter?
 
Leslie Chaim
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim, I don't know anything about any imposters.
Am I missing something here?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a bad joke. Responding to some of your previous posts in which you did not mention an alternate Perl solution, I had commented a couple times that obviously this was not the real Leslie Chaim, but some imposter. Now I see you're back. No criticism intended, just minor teasing...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic