Java新手新手新新手求助..帮忙compile 一下吧..
这个是在StudentTester.java里面的import java.util.Scanner;
public class StudnetTester{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Please enter your name");
String Name = scan.nextln();
System.out.println("Please enter your student ID");
int ID = scan.nextInt();
System.out.println("Please enter your address");
String Add = scan.nextLine();
Student std = new Student(Name, ID, Add);
int times = 0;
while (true)
{
System.out.println("Please enter your Quiz mark on by "
+"one. End with a negtive number.");
double mark = scan.nextDouble();
if (mark < 0)
break;
else
std.addQuiz(mark);
times++;
}
System.out.println("Student: " + "\t" + std.getName());
System.out.println("ID: " +"\t" +std.getStudentID());
System.out.println("Address: " +"\t" +std.getAddress());
System.out.println("Total times: " + "\t" +times);
System.out.println("Total score: " + "\t" + std.getTotalScore());
System.out.println("Adverage score: " + "\t" + std.getAdverage(times));
}
这个是在Student.java 里面的..
public class Student
{
public Student(String Name, int ID, String Add)
{
Sname = Name;
sID = ID;
sAdd = Add;
sTotal = 0;
sAdverge = 0;
}
public getName()
{
return sName;
}
public int getStudentID()
{
return sID;
}
public string getAddress()
{
return Sadd;
}
public void addQuiz(double mark)
{
sTotal = sTotal +mark;
}
public double getTotalScore()
{
return sTotal;
}
public double getAverageScore(int times)
{
sAdverge = sTotal / times;
return sAdverge;
}
private String Sname;
private int sID;
private String Sadd;
private double sTotal;
private int times;
private double sAdverge;
}
大家有空能帮忙compile 一下吗?
我的机子用的SciTe..一compile就说>javac StudentTester.java
>系统找不到指定的文件。
>javac Student.java
>系统找不到指定的文件。
C++的能用了..G++环境我应该是装好的了..装的时候我也选了java的...
郁闷了..然后然后..有什么错误能指出一下吗..谢谢~
[ 本帖最后由 叮叮 于 2009-5-18 12:11 编辑 ] 文件所在的路径不在环境变量里 试试将.加入系统环境变量PATH中
[ 本帖最后由 zipo 于 2009-5-18 13:31 编辑 ] 去外野求助或者去CSDN求助……
果然是老师布置得作业乜 吖...那怎么改的哦?
另..
student 是一个class..
那可以
student std = new student();
怎么才能实现建立多个不同名字的新档案哦?不用array..
就是实现
const int c = 200;
std;
while (ture)
{
student std = newstudent();
int a = scan.nextInt();
if ()
x++;
else
break;
} LS 你那c++
不也用的数组
翻翻Java数组吧
Student[] 对头= =嗯..在翻.. StudentTester.javaimport java.util.Scanner;
public class StudentTester {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println(\\"Please enter your name\\");
String Name = scan.nextLine();
System.out.println(\\"Please enter your student ID\\");
int ID = scan.nextInt();
System.out.println(\\"Please enter your address\\");
String Add = scan.nextLine();
Student std = new Student(Name, ID, Add);
int times = 0;
while (true) {
System.out.println(\\"Please enter your Quiz mark on by \\" + \\"one. End with a negative number.\\");
double mark = scan.nextDouble();
if (mark < 0)
break;
else
std.addQuiz(mark);
times++;
}
System.out.println(\\"Student: \\" + \\"\\t\\" + std.getName());
System.out.println(\\"ID: \\" +\\"\\t\\" +std.getStudentID());
System.out.println(\\"Address: \\" +\\"\\t\\" +std.getAddress());
System.out.println(\\"Total times: \\" + \\"\\t\\" +times);
System.out.println(\\"Total score: \\" + \\"\\t\\" + std.getTotalScore());
System.out.println(\\"Adverage score: \\" + \\"\\t\\" + std.getAverageScore(times));
}
}Student.javapublic class Student
{
public Student(String Name, int ID, String Add)
{
sName = Name;
sID = ID;
sAdd = Add;
sTotal = 0;
sAdverge = 0;
}
public String getName()
{
return sName;
}
public int getStudentID()
{
return sID;
}
public String getAddress()
{
return sAdd;
}
public void addQuiz(double mark)
{
sTotal = sTotal +mark;
}
public double getTotalScore()
{
return sTotal;
}
public double getAverageScore(int times)
{
sAdverge = sTotal / times;
return sAdverge;
}
private String sName;
private int sID;
private String sAdd;
private double sTotal;
private int times;
private double sAdverge;
}errors found after compiled, including use of bracket, incorrect spellings etc
对照之前的version看一下吧 ohoh~
谢谢楼上的~
页:
[1]