Hi guys, I need some help here with my programming homework, so i wish i can get some guidance from you all. That's also my reason for creating an account here.
Main Class
I have 4 objects containing three data types which is Integer,
String and String
Lets say:
Object1 = (1,Good day, Hello);
Object2 = (2,New Day, Goodbye);
Object3 = (3, Primary Day, Welcome);
Object4 = (4,Sunrise Day, Farewell);
Then, i add then into my linkedlist.
LinkedList Class (Problem)
My Main focus of this problem is the First String declared Which is Good day, New day, Primary Day, Sunrise day.
I am supposed to Sort them into ascending order based on alphabets
Hence, i decided to use ASCII to sort them.
But in order to use ASCII to sort, I will first have to traverse my linked list, followed by a for loop of my ASCII values and then create a if statement to say if my linkedlist first char is = to ASCII value, then it will sort.
BUT IT IS AN OBJECT, When i cast it to Char, it gives me error.
Also, I have a question here, if i were to cast this linked list to char, will it give me the first letter of the first string, example, the character 'G' from 'Good day' (First object)
I have been thinking about this for a week and it reaching my homework assignment soon. I hope to be able to get some help. Im a new programmer that started learning
java only so yeah.
Heres the codes that i have done up to: