java - 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?
解决方案
我不确定 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.
推荐阅读
- java - 如何渲染具有特定视野的图像?
- javascript - Fullcalendar Angular - Tooltip.js CSS 未应用(CSS 封装问题)
- php - 如何限制特定的谷歌用户可以读/写谷歌表?
- javascript - 如何将 HTML5 画布作为图像存储在框架列表中?
- javascript - 如何创建跨浏览器多范围滑块?(没有 jQuery)
- java - 反编译的 Java 类在方法变量上缺少最终关键字
- c - 带有互斥锁的 Pthreads 程序 - 每次打印相同的字符串
- c# - 将 Web 应用程序部署到谷歌云上的 ASP.NET 框架 VM 时如何修复 500 内部服务器错误?
- mysql - 无法在谷歌云 shell 中设置 mysql
- verilog - 异步重置警告问题