I've just started learning Java about 2 days back. I would like to know how do I write the code for the following :
1. An applet that accepts two numbers from the user and displays all the numbers between them.
2. Accept a string into a text field, sort the characters in the string and display. Display the sorted string in another text
field.
3. Write an applet to accept ten numbers into an array, sort the array and display the sorted array. Accept the ten
numbers into ten different text fields.
Manish Kapoor
1. First write an applet and put in two textfields. Maybe put a button or something around with an actionListener
attached to it which will let you know the user is done and so you can get the info with .getText() making sure that your
text fields are global and set this to a string, converting it to an interger(if you have problems with this one see former
questions). Then, still in the action listener, set up a for loop which will start at the first number and print out numbers
until the last number. You can display them using System.out.println(....) or set it up as a label or paint it.
2.sorting the characters in a string can be done by changing it to a character array(casting). Then for each character
you can use the compareTo() function to see if the character matches your constraints.
3.Similar to two and one but just convert strings to integers and then arrange.
If this is too general let me know and I'll try to write some code....might be awhile...in school now.
Shari