Earlier quoted context omitted.
I don't presume my institution is representative (nor that it isn't), but for what it's worth, most students I see are not slackers at all. Students often choose the harder courses, and many of them require a significant amount of work (a typical CS course requires 12 hours of work outside lecture and many require much more).
I wasn't a slacker until I took a computer graphics class that consumed more of my time than my other 4 classes combined, and I still failed it on a technicality (out for a job interview the day partners were assigned for the final project. Wasn't allowed to do the project alone, there were an odd number of people in the class. If you fail any "section" of the class, you fail the whole class. After back-and-forth wit…
University professor here.
Perhaps it's too late now, but I would encourage you to make a strenuous effort to get your professor in as much trouble with the administration as you can. I don't know who the "class dean" is -- but contact this person's department chair, the departmental undergraduate director, the dean of engineering, the dean of students, the provost, anybody, everybody. Whoever will listen.
What you experienced is not okay. I'm sure it's not an isolated incident, but it's also not the norm.