COMP 202 Lecture Notes - Lecture 7: Bracket
jc123 and 40170 others unlocked
100
COMP 202 Full Course Notes
Verified Note
100 documents
Document Summary
Write a program using if-else blocks to take a percentage grade and print the corresponding letter. The letter grade should be of type of type int. Because this ends with an else, and there"s no these condition after the else, conditions are true, then the student will get an f. This program would probably be more useful if the computer asked the grade. In order to obtain user input , we can create a variable of type java. util. scanner conversational shorthand. , or scanner in java. util. scanner input = new java. util. scanner(system. in); int myinteger = input. nextint(); This is a very odd looking variable. is the type in the same way that int is the type. is the variable name java. util. scanner input java. util. scanner(system. in); You can memorize it if you want, but on exams we will have an appendix with this kind of stuff on it.