java输入学生成绩代码 java输入学生成绩代码是什么
java编写程序:输入一个学生的成绩,给出相应的等,(用switch语句实现:0-59:D 60-69:C 70-84:B 85-100:A
import java.util.Scanner;
创新互联致力于互联网品牌建设与网络营销,包括网站建设、成都网站建设、SEO优化、网络推广、整站优化营销策划推广、电子商务、移动互联网营销等。创新互联为不同类型的客户提供良好的互联网应用定制及解决方案,创新互联核心团队10余年专注互联网开发,积累了丰富的网站经验,为广大企业客户提供一站式企业网站建设服务,在网站建设行业内树立了良好口碑。
/**
*
* @author Administrator
*/
public class TestSwitch {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner scanner = new Scanner(System.in);
int scort = scanner.nextInt();
if (scort = 0 scort = 100) {
switch (scort / 10) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
System.out.println("D");
break;
case 6:
System.out.println("C");
break;
case 7:
System.out.println("B");
break;
case 8:
if (scort 85) {
System.out.println("B");
} else {
System.out.println("A");
}
break;
case 9:
case 10:
System.out.println("A");
break;
default:
break;
}
} else {
System.out.println("请输入正确的得分[0-100]!!!");
}
}
}
急!急1急!用java编写简单的学生成绩录入程序
这里有一个类
实现学生学号,数学,语文,英语成绩录入
并且计算平均成绩,按照平均成绩高低输出信息
你可以改改!
//实现简单的学生信息输入输出和初步的成绩排序
public
class
student
{
private
int
id;
//学号
private
int
mathscore;
//数学成绩
private
int
chinscore;
//语文成绩
private
int
forescore;
//外语成绩
public
student()
{
id
=
0;
mathscore
=
0;
chinscore
=
0;
forescore
=
0;
}
public
student(int
newid,
int
newmathscore,
int
newchinsvore,
int
newforescore)
{
id
=
newid;
mathscore
=
newmathscore;
chinscore
=
newchinsvore;
forescore
=
newforescore;
}
public
double
getaveragescore()
{
//求平均成绩
double
averagescore
=
((double)
mathscore
+
chinscore
+
forescore)
/
3;
return
averagescore;
}
public
void
output(student
student)
{
//输出对象的内容
system.out.println("
"
+
student.id
+
"
"
+
student.mathscore
+
"
"
+
student.chinscore
+
"
"
+
student.forescore
+
"
"
+
student.getaveragescore());
}
public
int
max(student
a[],
int
n)
{
//student类对象数组的前n项中的成绩最大值的索引
int
position
=
0;
for
(int
i
=
1;
i
n;
i++)
{
if
(a[i].getaveragescore()
a[position].getaveragescore())
{
//比较平均成绩
position
=
i;
}
}
return
position;
}
public
void
selectsort(student
a[])
{
//student类对象数组的选择排序
for
(int
n
=
a.length;
n
1;
n--)
{
int
i
=
max(a,
n);
student
temp
=
a[i];
a[i]
=
a[n
-
1];
a[n
-
1]
=
temp;
}
}
}
如何用Java实现“学生成绩输入”问题?
import java.util.Scanner;\x0d\x0a public class Student{\x0d\x0a public static void main(String[] args){\x0d\x0a Scanner sc = new Scanner(System.in);\x0d\x0a System.out.println("请输入学生的人数....");\x0d\x0a int num = sc.nextInt();\x0d\x0a int[] arr = new int[num];\x0d\x0a double[] chengji_arr = new double[num]; //存放成绩的\x0d\x0a String[] String_arr = new String[num]; //存放姓名的\x0d\x0a String chengjis = "";\x0d\x0a String names = "";\x0d\x0a for(int i = 0; i
回答于 2022-11-16
编写程序,输入一个学生成绩,给出相应等级:60~100优秀0~50不及格(java代码实现)
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("请输入学生的分数:");
double score = input.nextDouble();
int level1,level2;
if(score=60.0 score=100.0){
System.out.print("该学生成绩为优秀!");
}
else if(score=0 score60.0){
System.out.print("该学生成绩为不及格!");
}
else{
System.out.print("您输入的成绩有误!");
}
}
}
名称栏目:java输入学生成绩代码 java输入学生成绩代码是什么
浏览地址:http://cdiso.cn/article/ddscjid.html