找回密码
 立即注册
搜索
查看: 1725|回复: 9

Java新手新手新新手求助..帮忙compile 一下吧..

[复制链接]
发表于 2009-5-18 12:01 | 显示全部楼层 |阅读模式
这个是在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 编辑 ]
回复

使用道具 举报

     
发表于 2009-5-18 12:25 | 显示全部楼层
文件所在的路径不在环境变量里
回复

使用道具 举报

     
发表于 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[c];
while (ture)
{
student std[x] = newstudent();
int a = scan.nextInt();
if ()
x++;
else
break;
}
回复

使用道具 举报

发表于 2009-5-18 14:20 | 显示全部楼层
LS 你那c++
不也用的数组
翻翻Java数组吧
Student[]
回复

使用道具 举报

 楼主| 发表于 2009-5-18 14:33 | 显示全部楼层
对头=   =嗯..在翻..
回复

使用道具 举报

发表于 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~

谢谢楼上的~
回复

使用道具 举报

头像被屏蔽
     
发表于 2009-5-18 18:11 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|上海互联网违法和不良信息举报中心|网上有害信息举报专区|962110 反电信诈骗|举报电话 021-62035905|Stage1st ( 沪ICP备13020230号-1|沪公网安备 31010702007642号 )

GMT+8, 2025-9-20 05:56 , Processed in 0.074431 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表