香港六合彩

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    香港六合彩 - Presentation Transcript

    1. CSC2 520 200 8 Spring Data Structures and Applications Assignment 1 FAQ Last updated: 4 Feb , 200 8
      • I collected some of the students’ questions together here.
      • You may encounter the same problems as other students.
      • Hope this can help your guys to do the assignment 1.
    2. Q1
      • Q: when I try to follow the tutorial note to input the file, the Eclipse point out that can't found the file.
        • My code:  
        • Scanner scanner = new Scanner(new File("d:/supermarket.dat"));
        • and i have already out the file in that path.
      • A: In this case, the path should be "d:\supermarket.dat". In the string, use “\” to represent character “”
    3. Q2
      • Q: I have define the class customer. when i want to use the method Customer(int T,int N, Float[] P) in supermarket class. The complier tell me that the constructor Customer is undefine. even if I use the Customer(int T,int N, Float[] P) as method, the complier still say that it is undefine.
      • here is my code:
      •  
      • for the constructor:
      • public Customer(int T, int N, float[] P) {   timeOfArrival=T;   numberOfItems=N;   System.arraycopy(P,0,itemPrices,0,P.length);  }
      •  
      • for the main class:
      •  
      • int arriveTime = n;
      • int ItemNum = value[n].length();
      • Float[] price = new Float[k+1];
      • Customer custom = new Customer(arriveTime, ItemNum, price);
      •  
      • then the compiler said that the last command is error.
      • A: From your description, it seems the compiler can not find the class.
      • I suggest you to check the following two thins:
      • 1. Is the class Customer defined in a individual file Customer.java?
      • 2. Does the file Customer.java put in the same folder with Supermarket.java?
    4. Q3 (Error about Object Array)
      • Q: I want to ask what is the java.lang.NullPointerException? And how can I solve the problem?
      • A: The Java runtime throws java.lang.NullPointerException when an application attempts to use a null value as if it were an object. I guess it caused by using the array.
      • Two possible explanations:
      • 1. You've indexed past the array bounds 2. You haven't initialized the array correctly
      • // example of an incorrectly initialized array:
      • public class Test {
      • public static void main(String args[]) {
      • String sa[] = new String[5];
      • sa[0].charAt(0);
      • }
      • }
      • // example of a correctly initialized array:
      • public class Test {
      • public static void main(String args[]) {
      • String sa[] = new String[5];
      • for(int i = 0; i < 5; i++) {
      • sa[i] = new String();
      • }
      • sa[0].charAt(0);
      • }
      • }
    5. Q4
      • 請問我用不用在每一個會有機會有 exception 的地方加上 throw HeyException 呢 ?
      • 答:我建議你可以這樣做,因爲這樣有助于你形成良好的編程習慣。在我們的作用中,良好的編程風格會有部分的分數。
    6. Q5
      • 我需不需要把 comment 寫在 source code 內 , 還是在 header 簡述即可 ?
      • 答: Comment 寫在 Code 内,在 Header 内是對整個 Class 的一個簡單描述
    7. Q6
      • 請問你有沒有一個 supermarket.dat 可測試 question2 的所有 function, 我已嘗試使用你所提供的 supermarket.dat 以及根據你的 tutorial note 用的 case 製做的 supermarket.dat 來測試 , 均能正常運作 , 這是否已經沒問題嗎 ?
      • 答:對不起,現在沒有, Test Case 會在檢查作業的時候才去設計。你可以自行設計一些數據,然後自己根據過程去計算結果,看看與程序結果是否一致來驗證。
    8. Q7
      • assignment 的 deadline 是中午 12 時嗎 ? 如是 , 可以押後至晚上 11:55pm 嗎 ?
      • 答: Deadline 是晚上 12 點
    9. Q8 About Scanner
      • Please follow the tutorial 02 about how to use the scanner

    + cctvcctv, 2 years ago

    custom

    503 views, 0 favs, 0 embeds more stats

    用词恰不恰当,有没有歧意存在。如果 more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 503
      • 503 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags