叮叮 发表于 2009-5-18 12:01

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 编辑 ]

dada 发表于 2009-5-18 12:25

文件所在的路径不在环境变量里

zipo 发表于 2009-5-18 13:06

试试将.加入系统环境变量PATH中

[ 本帖最后由 zipo 于 2009-5-18 13:31 编辑 ]

猫熊爱 发表于 2009-5-18 13:12

去外野求助或者去CSDN求助……

果然是老师布置得作业乜

叮叮 发表于 2009-5-18 13:14

吖...那怎么改的哦?

另..

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;
}

ov_efly 发表于 2009-5-18 14:20

LS 你那c++
不也用的数组
翻翻Java数组吧
Student[]

叮叮 发表于 2009-5-18 14:33

对头=   =嗯..在翻..

Breeze 发表于 2009-5-18 15:05

StudentTester.javaimport java.util.Scanner;

public class StudentTester {
               
        public static void main(String[] args) {
               
                Scanner scan = new Scanner(System.in);
               
                System.out.println(\\&quot;Please enter your name\\&quot;);
      String Name = scan.nextLine();
                        
      System.out.println(\\&quot;Please enter your student ID\\&quot;);
      int ID = scan.nextInt();
                        
      System.out.println(\\&quot;Please enter your address\\&quot;);
      String Add = scan.nextLine();               
                        
      Student std = new Student(Name, ID, Add);
                        
      int times = 0;
      
      while (true) {
                        System.out.println(\\&quot;Please enter your Quiz mark on by \\&quot; + \\&quot;one. End with a negative number.\\&quot;);
                        double mark = scan.nextDouble();
                              
            if (mark &lt; 0)
                    break;
            else
                    std.addQuiz(mark);
                times++;                        
                     }
                        
                System.out.println(\\&quot;Student: \\&quot; + \\&quot;\\t\\&quot; + std.getName());
      System.out.println(\\&quot;ID: \\&quot; +\\&quot;\\t\\&quot; +std.getStudentID());
      System.out.println(\\&quot;Address: \\&quot; +\\&quot;\\t\\&quot; +std.getAddress());
                System.out.println(\\&quot;Total times: \\&quot; + \\&quot;\\t\\&quot; +times);
      System.out.println(\\&quot;Total score: \\&quot; + \\&quot;\\t\\&quot; + std.getTotalScore());
                System.out.println(\\&quot;Adverage score: \\&quot; + \\&quot;\\t\\&quot; + 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看一下吧

叮叮 发表于 2009-5-18 15:34

ohoh~

谢谢楼上的~

AOSI 发表于 2009-5-18 18:11

页: [1]
查看完整版本: Java新手新手新新手求助..帮忙compile 一下吧..