Hello, I am writing a program that is to calculate the cost to install carpet in a room, get user input for price per square foot, length, and width of the room. Then output all the default values results, user input results, as well as a pre scheduled results.
I am stuck line 29 - 31 in the first segment of code, I receive the error
" The method displayResults(Measure) is undefined for the type CarpetCalcDemo "
However, I do have a displayResults method 78 - 85 in the second segment of code,
is their a better way to output all of these results???
You are calling the display method on the wrong thing.
You also shouldn't call the method display; you should override the toString method, then you can simply say
System.out.println(myMeasure); and get a sensible output.
Why have you got all those comments which don't tell anybody anything that isn't obvious from reading the code?
Why have you got that repeated code in the setXXX methods? That should be refactored into a method of its own.