skip to main |
skip to sidebar
Type: LogicScreenshot: 1 2
Description: While working on the 'toPigLatin' translater method in my PigLatin program, I found a glaring logic error. Instead of translating properly by moving all in front of the vowel to the back, the program would move the vowel, along with the proper segments, to the back. This error is shown in screenshot #2. I found my error in a for loop in my 'toPigLatin' method, where I initialized the counter in my for loop one value too long and the character saved inside the loop one too small. This problem was solved by moving the '-1' from
chrTemp = Character.toLowerCase( strWords[intCount].charAt(intVCheck - 1));
to the intVCheck initialization in the for loop preceding it,
for(int intVCheck = this.strWords[intCount].length() - 1; intVCheck > 0; intVCheck--)
Type: LogicScreenshot: 1 Description: I've had this screenshot a while now, from the GradeAve program and have not managed to remember posting it until now. Basically, in the getCont method of my program, I had alternated the boolean results for Y and N. As a result, when the user inputted Y (for Yes) when asked whether or not to continue, the program would end, and, when the user inputted N (for No), it would continue.
Type: Logic
Screenshot: 1
Description: An error occured while testing my CashReg program's change calculation process, where, if the change required had decimals above .5, the change recommended would come in negatives. I found this to be an error in the formula I used in order to remove values above a dollar from the change variable.
The formula, which was at the time:
dblChange = dblChange - Math.round(dblChange)
Instead of working with a double, since the rounding method I used had obvious holes, I instead used a variable casting method, changing the double-change into an integer, a process where it would automatically round down.
Editted formula:
dblChange = dblChange - (int)dblChange;
This change in the formula promptly fixed the problem.
Type: LogicScreenshots: 1 Description:Another testament to my well-thought out, meticulous work habits, I managed to switch two variables, creating a completely wrong answer. By looking through my input section (that I reasoned was most logical location for the error to be), I found that I had intMax inputted with the intIncr prompt line. By switching them to the correct order, the error disappeared.
Type: SyntaxScreenshots: 1Description:Forgetting about JCreator's automatic bracket closing feature, I placed one too many close brackets in my program. This error was detected by the Java Compiler as I attempted to compile and run the program.
This error was quickly fixed by removing the excess bracket.
Type: SyntaxScreenshot: 1
Description: In my haste while working to complete my payroll program, I managed to overlook actually naming the class to declare. I used the usual class declaration method (public class) but did not name the class afterwards. This error was detected by the java compiler when I attempted to compile and run the program.
This problem was solved by merely giving the class a name (Payroll).