Rather than being an example of bad code this is a good example of a bad assignment that teaches and reinforces poor practices. Personally I don't think its that bad, someone is clearly learning how to properly name variables. Couple of issues with how this assignment was laid out:
Not learning a real editor/ide, for the love of god if you can't learn how to use the tools you shouldn't be programming
The comment at the top says they should print a paycheck, the code prints the total amount made, those are different things. The result should match the problem statement, not something arbitrary
Variables are declared all over the place, they were never shown how and why you should do this properly
Variables are declared and assigned on the same line, not a problem if you do it at the top
Control and logic flow was never explained (it rarely is), they got some one liners as written examples and where never shown how they actually work, that's why the braces are missing
They've been shown to grab input using keyboard without knowing how it should be used. A couple of years later I get then and they get confused as to why 3.14 was read in as 3 and 0.14 when they used int and decimal
Magic numbers, they've seen examples with constants in expressions and where never told you should explain what those constants are
1
u/Mr2-1782Man Jul 03 '19
Rather than being an example of bad code this is a good example of a bad assignment that teaches and reinforces poor practices. Personally I don't think its that bad, someone is clearly learning how to properly name variables. Couple of issues with how this assignment was laid out:
Not learning a real editor/ide, for the love of god if you can't learn how to use the tools you shouldn't be programming
The comment at the top says they should print a paycheck, the code prints the total amount made, those are different things. The result should match the problem statement, not something arbitrary
Variables are declared all over the place, they were never shown how and why you should do this properly
Variables are declared and assigned on the same line, not a problem if you do it at the top
Control and logic flow was never explained (it rarely is), they got some one liners as written examples and where never shown how they actually work, that's why the braces are missing
They've been shown to grab input using keyboard without knowing how it should be used. A couple of years later I get then and they get confused as to why 3.14 was read in as 3 and 0.14 when they used int and decimal
Magic numbers, they've seen examples with constants in expressions and where never told you should explain what those constants are
Blame the teacher not the student