Java基础编程题(3)

本文介绍了如何用Java编写一个Circle类,该类包含设置圆半径的方法,并能计算及显示圆的面积和周长。
摘要由CSDN通过智能技术生成
9.依次输入10个学生成绩,判断学生(优秀、良好、中等、及格、不及格)用switch
package test1;

import java.util.Scanner;

public class example9 {

	public static void main(String[] args) {
int n=0;		// TODO Auto-generated method stub
System.out.println("成绩:");

Scanner sc =new Scanner (System.in);
int stu=sc.nextInt();
if (stu>100) System.out.println("成绩错误");
if (stu<0) System.out.println("成绩错误");
if (stu>90) n=1; 
if (stu>80) n=2; 
if (stu>70) n=3; 
if (stu>60) n=4; 
if (stu<60&&stu>0) n=5; 
switch(n) {
case 1:System.out.println("优秀");
case 2:System.out.println("良好");
case 3:System.out.println("中等");
case 4:System.out.println("及格");
case 5:System.out.println("不及格");
}


	}

}

10.编写一个circle类

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值