急!!!JAVA编程求答案。十万火急!!!

如题所述

package com.itek.test;
/*
* @autor Aaron Jone
* @datetime:2017年3月13日 下午1:17:36
*/
public class Student {

private int age;    // 年龄
private String department;    // 院部
private String major;    // 专业
private String name;    // 姓名
private int clazz;    // 班级
private double oop;    // 面向对象程序设计
private double net;    //网络原理
private double db;    //数据库
private double totalScore;    //总分

/*
* 无参构造方法:
*/

public Student(){

}

/*
* 有参构造方法:
*/
public Student(int age, String department, String major, String name, int clazz, double oop, double net, double db) {
super();
this.age = age;
this.department = department;
this.major = major;
this.name = name;
this.clazz = clazz;
this.oop = oop;
this.net = net;
this.db = db;
}


public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getMajor() {
return major;
}
public void setMajor(String major) {
this.major = major;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getClazz() {
return clazz;
}
public void setClazz(int clazz) {
this.clazz = clazz;
}
public double getOop() {
return oop;
}
public void setOop(double oop) {
this.oop = oop;
}
public double getNet() {
return net;
}
public void setNet(double net) {
this.net = net;
}
public double getDb() {
return db;
}
public void setDb(double db) {
this.db = db;
}
public double getTotalScore() {
return totalScore;
}
public void setTotalScore(double totalScore) {
this.totalScore = totalScore;
}
}
-------------------------------------------------------------------------------------

package com.itek.test;

import java.util.Scanner;

/*
* @autor Aaron Jone
* @datetime:2017年3月13日 下午1:23:45
*/
public class MyStudent {

public static void main(String[] args) {
//第一题:
Student student = new Student();    // 创建对象

student.setAge(22);    //年龄设置为:22
student.setClazz(1);    //班级设置为:1
student.setDb(67.5);    //数据库分数设置为:67.5
student.setDepartment("计算机学院");    //院部设置为:计算机学院
student.setMajor("软件工程");    //专业设置为:软件工程
student.setName("张三");    //姓名设置为:张三
student.setNet(87.8);    //网络原理分数设置为:87.8
student.setOop(97.0);    //面向对象程序设计分数设置为:97.0
/*
* 计算总成绩存入totalScore变量中
*/
double totalScore = student.getDb()+student.getNet()+student.getOop();
student.setTotalScore(totalScore);//设置学生总分为:totalScore
/*
* 在控制台打印
*/
System.out.println("姓名:"+student.getName()+"\t学院:"+student.getDepartment()+"\t专业:"+student.getMajor()+"\t班级:"+student.getClazz()+"\t总分:"+student.getTotalScore());


//第二题:
Student stu1 = new Student(23, "计算机学院", "软件工程", "李四", 2, 67.5, 79, 96);
double totalScore2 = stu1.getDb()+stu1.getOop()+stu1.getNet();
stu1.setTotalScore(totalScore2);
System.out.println("姓名:"+stu1.getName()+"\t学院:"+stu1.getDepartment()+"\t专业:"+stu1.getMajor()+"\t班级:"+stu1.getClazz()+"\t总分:"+stu1.getTotalScore());


//第三题    顺序一定要是:age clazz db oop net name department major
Student stu2 = new Student();
stu2.setAge(Integer.parseInt(args[0]));
stu2.setClazz(Integer.parseInt(args[1]));
stu2.setDb(Double.parseDouble(args[2]));
stu2.setOop(Double.parseDouble(args[3]));
stu2.setNet(Double.parseDouble(args[4]));
stu2.setName(args[5]);
stu2.setDepartment((args[6]));
stu2.setMajor((args[7]));
//设置完了,计算总成绩并设置总成绩
double totalScore3 = stu2.getNet()+stu2.getOop()+stu2.getDb();
stu2.setTotalScore(totalScore3);
//输出打印
System.out.println("姓名:"+stu2.getName()+"\t学院:"+stu2.getDepartment()+"\t专业:"+stu2.getMajor()+"\t班级:"+stu2.getClazz()+"\t总分:"+stu2.getTotalScore());

//第四题
Student stu3 = new Student();
//设置年龄
System.out.println("请输入年龄:");
int age = Integer.parseInt(MyStudent.getInput());
stu3.setAge(age);

//设置班级
System.out.println("请输入班级:");
int clazz = Integer.parseInt(MyStudent.getInput());
stu3.setClazz(clazz);

//设置院部
System.out.println("请输入院部:");
String department = MyStudent.getInput();
stu3.setDepartment(department);

//设置专业
System.out.println("请输入专业:");
String major = MyStudent.getInput();
stu3.setMajor(major);

//设置姓名
System.out.println("请输入姓名:");
String name = MyStudent.getInput();
stu3.setName(name);

//设置数据库成绩
System.out.println("请输入数据库成绩:");
double db = Double.parseDouble(MyStudent.getInput());
stu3.setDb(db);
//设置面向对象程序设计成绩
System.out.println("请输入面向对象程序设计成绩:");
double oop = Double.parseDouble(MyStudent.getInput());
stu3.setOop(oop);
//设置网络原理成绩
System.out.println("请输入网络原理成绩:");
double net = Double.parseDouble(MyStudent.getInput());
stu3.setNet(net);
//设置完了,计算总成绩并设置总成绩
double totalScore4 = stu3.getNet()+stu3.getOop()+stu3.getDb();
stu3.setTotalScore(totalScore4);

//打印输出
System.out.println("姓名:"+stu3.getName()+"\t学院:"+stu3.getDepartment()+"\t专业:"+stu3.getMajor()+"\t班级:"+stu3.getClazz()+"\t总分:"+stu3.getTotalScore());
}

/*
* 静态方法:也叫类方法
* 调用方式:类名.方法名
* 功能:get控制台输入的 数据,返回字符串类型
*/
public static String getInput(){
Scanner sc = new Scanner(System.in);
return sc.nextLine();
}
}

温馨提示:内容为网友见解,仅供参考
第1个回答  2017-03-13
感觉好像北大青鸟的练习题。

用Java编程序!十万火急!谢了
先回答:4:public class Plus { \/ param args \/ public static void main(String[] args) { for(int i=1;i<=9;i++){ \/\/ for(int j=1;j<=i;j++){ System.out.print(j+"*"+j+"="+i*j);System.out.print(" ");if(j==i){ System.out.print("\\n");} } } } } ...

Java 代码 求大神帮助十万火急!!
public static void main(String[] args) {Scanner input = new Scanner(System.in);ArrayList<Integer> L = new ArrayList<>(10);int X = 1;int Y = 0;while (true) {if(L.size()>=10)break;System.out.printf("Integer " + X + ":", (X + 1));X++;Y++;L.add(input.next...

java怎么跳出if~十万火急
out:if(a==1){ if(b==2){ break out;} if(c==3){ } } if(d==4){ System.out.print("df");}

跪求JAVA小程序!十万火急!!!
import java.applet.Applet;import java.awt.*;public class Calc extends Applet{ private Button button0,button1,button2,button3,button4,button5,button6,button7,button8,button9,jia,jian,deng,cheng,chu,clear;TextField show,result;String s1="",s2,s4,s5,s6;char s3,ch1;double num1,...

十万火急、、!!!java初学者、求大婶帮忙看看这是什么错误、、、_百度知...
if(int i=0; i< course.length; i++){ } if是条件判断语句括号里的值应该是boolean型 for才是循环语句,改成 for(int i=0; i< course.length; i++){ }

用java语言编写画随机的圆 十万火急 求大神帮忙!!!
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.J...

...我有一段java程序需要修改,请帮帮我,十万火急!谢谢!悬赏可追加...
boolean boo=rs.next();执行这一句之后,rs的指针指向下一个,如果rs里面只有一条记录,在执行 while(rs.next()){ 时就会发现rs已经到最后了,rs.next()返回值为false,判读失败。

程序阅读题,JAVA高手来回答一下。十万火急,感谢
Base Severn 当子类中没有用super()调用父类的构造函数时,会在子类构造函数第一行自动添加上父类无参构造函数,所以子类实例化时,会先调用父类的无参构造函数。

求JAVA记事本代码(十万火急!越快越好!)
import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.File;public class Test extends JFrame implements ActionListener { \/ \/ private static final long serialVersionUID = 1L;JMenu fileMenu, editorMenu, formatMenu; \/\/ 设置文件菜单,编辑菜单,格式菜单 JMenuItem...

十万火急!!!java高手情进!!!
import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;public class Jiami extends JFrame implements Action...

相似回答