帮忙编写一个java程序

[复制链接]
查看11 | 回复4 | 2011-5-16 14:55:04 | 显示全部楼层 |阅读模式
编写一个java程序,能够将一个百分制数(如91)转化成优秀(100-90)、良好(89-80)、合格(79-60)和不合格(59及以下),并输出。

回复

使用道具 举报

千问 | 2011-5-16 14:55:04 | 显示全部楼层
public static void main(String[] args) {java.util.Scanner scanner = new java.util.Scanner(System.in);String isGo = "y";while(isGo.toUpperCase().equals("Y")){System.out.print("请输入分数:");String source = scanner.next();while(!isInteger(source)){System.out.println("输入的分数不是一个有效的数字\n请从新输入分数:");sou
回复

使用道具 举报

千问 | 2011-5-16 14:55:04 | 显示全部楼层
public class test {public static void main(String[] args){int number = 91;String str = "";if(number >= 90){str = "优秀(100-90)";}else if(number >= 80){
回复

使用道具 举报

千问 | 2011-5-16 14:55:04 | 显示全部楼层
public class Conversion {public static void main(String[] args){int score=0;String level="";Scanner scan = new Scanner(System.in);score=Integer.parseInt(scan.nex
回复

使用道具 举报

千问 | 2011-5-16 14:55:04 | 显示全部楼层
先把百分数转换成整数,用 switch 就行了啊,java基础的书里都有这样的例子。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行