189 8069 5689

java学生报名代码编写 java考试报名

java代码编写

这个比较简单,我说一下方法,你打开eclipse,新建一个项目,然后在src里面新建一个学生类,后面的一步一步走,那步不懂就问

我们提供的服务有:成都网站设计、成都网站建设、微信公众号开发、网站优化、网站认证、万全ssl等。为上1000+企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的万全网站制作公司

JAVA编写学生类student题目

(1)

public static void main(String[] args){

int count = 0;

for(int i=0;i100;i++){

if(i%3==0){

count+=i;

}

}

System.out.print("100以内能被3整除的和为:"+count);

}

(2)

public class Student {

private String name ;

private int computer_score;

private int English_score;

private int Maths_score;

public Student(String name,int computer_score,int English_score,int Maths_score){

this.name=name;

this.computer_score = computer_score;

this.English_score=English_score;

this.Maths_score = Maths_score;

}

public void setName(String name){

this.name=name;

}

public void setComputer_score(int computer_score){

this.computer_score=computer_score;

}

public void setEnglish_score(int English_score ){

this.English_score = English_score;

}

public void setMaths_score(int Maths_score ){

this.Maths_score = Maths_score;

}

public int getTotalScore( ){

return this.computer_score+this.English_score+this.Maths_score;

}

public void introduce ( ){

System.out.print("姓名:"+this.name+",总成绩为:"+getTotalScore());

}

}

class homework2{

public static void main(String[] args){

Student xiaozhang = new Student("小张",60,70,80);

xiaozhang.introduce();

}

}

要求编写一个java程序,输入学生信息,并能保存与显示学生信息。

import java.util.ArrayList;

import java.util.Scanner;import com.sun.org.apache.xpath.internal.Arg;

public class Student {

//两个私有属性

private int no ;

private String name ;

//默认构造函数

public Student(){}

//带参构造函数

public Student(int no,String name){

this.no=no;

this.name=name;

}

//添加学生信息

public void addStudentInfo(ArrayList list){

String flag1="yes";

do{

Student student=new Student();

Scanner in =new Scanner(System.in);

System.out.println("请输入学生学号:");

student.setNo(in.nextInt());

System.out.println("请输入学生姓名:");

student.setName(in.next());

list.add(student);

System.out.println("是否继续添加学生信息(yes/no)?");

flag1=in.next();

} while(flag1.equals("yes"));

}

//读取学生信息

public void showStudentInfo(ArrayListStudent list){

System.out.println(" 学生no: "+" 学生name: ");

for(Student student:list){

System.out.println(" "+student.getNo()+" "+student.getName());

}

}

public int getNo() {

return no;

}

public void setNo(int no) {

this.no = no;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public static void main(String arg[]) {

ArrayListStudent studentList= new ArrayListStudent();

Student student= new Student();

Scanner inn= new Scanner(System.in);

while(true){

System.out.println("----------------- 欢迎使用学生管理系统------------------");

System.out.println("1.输入学生信息");

System.out.println("2.显示学生信息");

System.out.println("0.退出系统");

System.out.println("请选择....");

int nn= inn.nextInt();

switch (nn) {

case 1:

student.addStudentInfo(studentList);

break;

case 2:

System.out.println("学生信息如下:");

student.showStudentInfo(studentList);

break;

case 0:

System.exit(0);

System.out.println("系统退出!");

break;

default:

break;

}

}

} }


分享题目:java学生报名代码编写 java考试报名
URL网址:http://cdxtjz.cn/article/doideeg.html

其他资讯