Hwk - Outputting names in alphabetical order

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

30 Replies - 1555 Views - Last Post: 17 November 2013 - 09:18 AM Rate Topic: -----

#16 Misspelt  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 16-October 13

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 12:54 PM

I'm absolutely lost, is it forbidden on this site for you to complete what I started?

This post has been edited by andrewsw: 16 October 2013 - 01:02 PM
Reason for edit:: Removed unnecessary quote

Was This Post Helpful? 0
  • +
  • -

#17 ybadragon  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 275
  • View blog
  • Posts: 1,464
  • Joined: 11-May 12

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:03 PM

We don't do your homework for you. We will point you in the right direction, then it is up to you to research what is suggested, and report back your findings if you have more questions. What you need to do is read up on If Else statements, since your original code uses .CompareTo() I would recommend reading up on that as well.

From Official Dream.In.Code Rules

Quote

Members of Dream.In.Code are here to help you, we will not not do your homework for you, or just give you code.

Was This Post Helpful? 0
  • +
  • -

#18 Misspelt  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 16-October 13

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:04 PM

But I did most of it already, so helping me out with the ending part isn't exactly doing all my homework for me

This post has been edited by andrewsw: 16 October 2013 - 01:10 PM
Reason for edit:: Removed quote

Was This Post Helpful? 0
  • +
  • -

#19 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3730
  • View blog
  • Posts: 13,024
  • Joined: 12-December 12

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:11 PM

Comparing two names is much simpler than comparing three, so this isn't a question of finishing off work for you - which we don't do anyway.

If you are completely lost then you should either speak to your teacher or go back through your book or notes. ybadragon has also provided a link for if..else statements.

Please also note that there is no need to keep quoting the entire previous post - there is a larger Reply button a little further down the page.

This post has been edited by andrewsw: 16 October 2013 - 01:13 PM

Was This Post Helpful? 0
  • +
  • -

#20 Misspelt  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 16-October 13

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:13 PM

Thanks for nothing guys
Was This Post Helpful? -2
  • +
  • -

#21 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9487
  • View blog
  • Posts: 35,780
  • Joined: 12-June 08

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:14 PM

Well think about it... it's like those logic problems of "if Jon is older than Sue, but Sue is younger than Timmy.. what order should they go in from youngest to oldest?".

if you have the following:

int a = 7
int b = 2
int c = 4


.. and you want to order from highest to lowest
'start comparing a and b.

IF (a > B )
'-- if A is greater than B we just need to figure out where C falls in there.
    IF (b > c )
    '-- this means a is greater than b and b is greater than c so you print out a, b, c.
    ELSEif ( b < c)
    '-- this means a is greater than b.. but b is smaller than c.. so you print out a, c, b.
    ELSE
    '-- this means b and c are interchangable.. so might as well just print a, b, c
    END IF
ELSEif (a < B)/>/>/>
    '-- extrapolate from above..
ELSE '-- (this means if a = B)/>/>/>
    '-- extrapolate from above..
END IF


View PostMisspelt, on 16 October 2013 - 03:13 PM, said:

Thanks for nothing guys

Such a wonderful 'tude. :sigh:
Was This Post Helpful? 0
  • +
  • -

#22 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3730
  • View blog
  • Posts: 13,024
  • Joined: 12-December 12

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:18 PM

bubble sort :wiki

Posted Image
Was This Post Helpful? 0
  • +
  • -

#23 ybadragon  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 275
  • View blog
  • Posts: 1,464
  • Joined: 11-May 12

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:21 PM

That has got to be the longest .gif I've ever seen :sleepy:
Was This Post Helpful? 0
  • +
  • -

#24 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3730
  • View blog
  • Posts: 13,024
  • Joined: 12-December 12

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:23 PM

View Postybadragon, on 16 October 2013 - 08:21 PM, said:

That has got to be the longest .gif I've ever seen :sleepy:/>

I quite like it though - simple and effective :)
Was This Post Helpful? 0
  • +
  • -

#25 Misspelt  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 16-October 13

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:39 PM

View Postmodi123_1, on 16 October 2013 - 01:14 PM, said:

Well think about it... it's like those logic problems of "if Jon is older than Sue, but Sue is younger than Timmy.. what order should they go in from youngest to oldest?".

if you have the following:

int a = 7
int b = 2
int c = 4


.. and you want to order from highest to lowest
'start comparing a and b.

IF (a > B )
'-- if A is greater than B we just need to figure out where C falls in there.
    IF (b > c )
    '-- this means a is greater than b and b is greater than c so you print out a, b, c.
    ELSEif ( b < c)
    '-- this means a is greater than b.. but b is smaller than c.. so you print out a, c, b.
    ELSE
    '-- this means b and c are interchangable.. so might as well just print a, b, c
    END IF
ELSEif (a < B)/>/>/>/>
    '-- extrapolate from above..
ELSE '-- (this means if a = B)/>/>/>/>
    '-- extrapolate from above..
END IF


View PostMisspelt, on 16 October 2013 - 03:13 PM, said:

Thanks for nothing guys

Such a wonderful 'tude. :sigh:/>

YOu seem like the only helpful one here ... I have tried to put what you said in practice but it just ain't working :(
Was This Post Helpful? 0
  • +
  • -

#26 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9487
  • View blog
  • Posts: 35,780
  • Joined: 12-June 08

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:40 PM

I have no idea what you tried, but the analogy make sense to you? In terms of how to compare one another to another?
Was This Post Helpful? 0
  • +
  • -

#27 DarenR  Icon User is offline

  • D.I.C Lover

Reputation: 495
  • View blog
  • Posts: 3,298
  • Joined: 12-January 10

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:41 PM

repost your new code and people will help you more
Was This Post Helpful? 0
  • +
  • -

#28 Misspelt  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 16-October 13

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:54 PM

View Postmodi123_1, on 16 October 2013 - 01:40 PM, said:

I have no idea what you tried, but the analogy make sense to you? In terms of how to compare one another to another?

Yeah it makes completely sense when using numbers, but I don't see how I can apply that properly to what I am doing because I can't simply put if x > y and z > y etc...
Was This Post Helpful? 0
  • +
  • -

#29 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9487
  • View blog
  • Posts: 35,780
  • Joined: 12-June 08

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:57 PM

Read the post I had about the ".contains". What are the values it gives you? A positive number when one is greater than another.. 0 when they are equal.. and a negative number when one is less than the other. Numbers.. they are numbers in the return.
Was This Post Helpful? 0
  • +
  • -

#30 Misspelt  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 12
  • Joined: 16-October 13

Re: Hwk - Outputting names in alphabetical order

Posted 16 October 2013 - 01:58 PM

View PostDarenR, on 16 October 2013 - 01:41 PM, said:

repost your new code and people will help you more

That's the problem, I've been trying to use all tips posted here but none of them helped me so essentially the coding is still the same as the first code I posted
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3