Difference between revisions of "Ifless Grade Calculator"
(further clarification of the problem) |
m (grammar edit in by students) |
||
Line 36: | Line 36: | ||
|SideSectionTitle=...by students | |SideSectionTitle=...by students | ||
− | |SideSection=Mike Domaratzki, my 1010 professor, asked | + | |SideSection=Mike Domaratzki, my 1010 professor, asked my class this problem on the second week of class. Of about 100 students, only 2 of us solved it. I remembered sitting through my class after 1010, furiously trying to solve the problem by hand. When I coded the program up, it took me an hour to debug. When I finally got it working, the sense of accomplishment was overwhelming. |
This is a difficult problem, one the would probably stump many fourth year students. Even though I know the trick for solving this problem, adding the plus grades was a bit difficult for me as well. | This is a difficult problem, one the would probably stump many fourth year students. Even though I know the trick for solving this problem, adding the plus grades was a bit difficult for me as well. |
Revision as of 14:46, 9 April 2010
Back to the Program-A-Day homepage
ProblemSunday Stumpers are the Sunday New York Times Crossword Puzzle of Program A Day. The problems are intentionally difficult, and the average student probably won't be able to get the whole solution by themselves. They will never contain anything that the students haven't learned, but they may apply things the students have learned in unorthodox ways. The solution will contain several hints and the actual code. Next week you are going to be learning conditional statements (like if statements). This will allow you to make much more powerful programs. One problem that you are going to be asked to do next week, is to make a program that converts number grades into letter grades. Technically, it is possible to write this program without a single if statement. Create a program that will allow the user to enter in a decimal letter grade, and will output the letter grade. The number grade should be entered using consecutive JOptionPane.showInputDialog, and the result should be given using System.out.println. Assume valid inputs. Don't use ifs, loops, arrays or anything else that have not yet been discussed. The grades breakdown is as follows:
If you can get that working, then add plus grades:
Don't worry about plus grades until you have normal letter grades working
You will need the following:
|
...by studentsMike Domaratzki, my 1010 professor, asked my class this problem on the second week of class. Of about 100 students, only 2 of us solved it. I remembered sitting through my class after 1010, furiously trying to solve the problem by hand. When I coded the program up, it took me an hour to debug. When I finally got it working, the sense of accomplishment was overwhelming. This is a difficult problem, one the would probably stump many fourth year students. Even though I know the trick for solving this problem, adding the plus grades was a bit difficult for me as well. | |
---|---|---|
SolutionHint 1: You can increment and decrement char values, just like you can ints | ||
Code |