首页 > 解决方案 > Program that asks user to input quiz scores and gives back a letter grade

问题描述

I need help writing a program that asks for the user to input a grade that is out of 10 and then it will give back the corresponding letter grade "A,B,C,D,F" I need to use a for loop with a switch statement. How can I start this?

标签: javaloopsfor-loopswitch-statement

解决方案


我不确定 for 循环的用途是什么。将输入存储到整数变量后,您可以对每个可用情况使用 switch 语句。为此,您将有案例 0-10。例子:

switch (int name here){
    case 1: System.out.println("F");
    break;
    case 2: System.out.println("F");
    break;
//Continue for each available number and the grade corresponding to it. 

推荐阅读