Stuart A. Burkett wrote:
Liam Smith wrote:
Stuart A. Burkett wrote: No it's not. Your code doesn't do what the specification says.
Can you clarify on this? When I run the program, input the at least 3 values and end the program. Linked list does return in reverse order which assignment asked for?
Assuming that it's lines 64 - 69 that supposedly do that, the code is inside the while loop so will print out every time round the loop, not just after the user has pressed something other than 'y'.
There's also a better method than listIterator to get the list in descending order. The highlighted word is to give you a clue.
fred rosenberger wrote:I would say it doesn't since it won't compile as written above:
Stuart A. Burkett wrote: No it's not. Your code doesn't do what the specification says.
Campbell Ritchie wrote:Welcome to the Ranch
That is not an Enumeration, but an enumerated type. Enumeration is an old legacy interface which you ought not to use in new code.
What you are doing is getting confused about what you can use for the switch‑case statement. You ought to be using the members of that enum, bvut you have managed to write it taking Strings. Change the set discount method parameter to take the customer type enum as an argument, and it should work better.
Various things could be tidied up:-I don’t like the name of the set discount method. Maybe setDiscountFromCustomerType??? You are calling the getDiscount method twice, but only using its return value once.
Winston Gutkowski wrote:
Liam Smith wrote:I am having issue with the following code. I need to return the description from enumeration...
1. Be careful when using the term "enumeration" to Java programmers - especially with a capital 'E' - because there is already a legacy class called Enumeration, and it's NOT the same as an enum.
2. Seems to me that you could put your discounts in your enum, viz:and save yourself a pile of problems.
HIH
Winston