Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Assignment FAQ | COS 126 Spring'22 Search COS 126 Spring'22 COS 126 Spring'22 Syllabus Schedule Assignments Project Resources Exams People Light Dark Automatic Assignment FAQ Q: Do my programs need to handle every conceivable input? A: No. Your program must handle all meaningful inputs, but you need not worry about meaningless ones. For example, when testing RGBtoCMYK.java, we will always supply three command-line arguments that are integers between 0 and 255. Q: How will I access my work after it has been graded? A: You will login to codePost, a system designed by Princeton undergraduates to streamline our grading workflow. Q: Can I submit assignments via email, hardcopy, or Snapchat? A: No, all assignments submissions must be done via TigerFile. Q: What’s TigerFile? A: A web-based system that you will use to submit assignments. Every assignment has its own submission link. Q: How do I successfully submit an assignment? A: Remove any extraneous debugging statements from your code. Upload all of the required files. The filenames are case-sensitive. Be sure to submit the most up-to-date version of your code. After testing on your computer, click the Check Submitted Files button to receive feedback. Fix any errors. Q: Can I correct my program and resubmit? A: Absolutely. That’s the point of this sytem. There is no penalty for resubmitting files prior to the deadline. Q: When I submit a file, TigerFile reports Filename is not in list. Why is it rejecting my submission? A: Be sure the file has the correct name. Both the capitalization and .java extension are important. We recommend configuring your system to show the file extensions. Here are instructions for Mac and Windows). Q: How do I submit an assignment after the deadline? A: You must mark the checkbox in TigerFile that indicates that your work is incomplete. Otherwise, we will grade your most recent submission when we begin grading. When you are ready to have the assignment graded, uncheck the checkbox: I will be submitting late checkbox. There is no need to mark (and unmark) the checkbox if you are submitting before the deadline. Q:On assignments that allow partnering, how do my partner and I submit? A: Either partner many submit files. Q: What exactly does the Check Submit Files button in TigerFile do? A: It compiles and executes your program on the inputs specified in the assignment specification. It also runs two tools, Findbugs and Checkstyle, that automatically identify common bug patterns and style issues in Java programs. Q: Must I submit all of the required files to receive feedback? A: No, you will receive feedback on whichever files you submit. Q: I receive various compiler errors and warnings. What does this mean? A: Your programs should compile cleanly, with no errors or warnings. Consult a staff member if you are unsure how to fix them. Q: I receive various Findbugs warnings. What does this mean? A: Findbugs is a program that looks for common bugs in your program. You should consider anything it reports an error (though there are occasionally false positives). Consult the course staff if you are unsure what an error message means or how to fix it. Q: I receive various Checkstyle warnings. What does this mean? A: Checkstyle is a program that looks for common style issues in your program. The appearance of a warning message does not necessarily lead to a deduction (and, in some cases, it does not even indicate an error). However, if you are learning to program in Java, you should strive to fix any issues that Checkstyle flags. You should pay particular attention to the custom checks, which are specialized to each program. Consult the course staff if you do not understand an error message or how to correct it. Q: Will Checkstyle ever like me? A: No, Checkstyle is a computer program. However, as you gain programming experience, you’ll get used to the myriad (and sometimes seemingly arbitrary) conventions that good programmers employ, and you will learn to like Checkstyle. Q: I receive various FAILED messages in the correctness tests. What does this mean? A: Your program does not meet the assignment specifications on the tested inputs. Failing any of these tests will lead to a deduction. (Passing all of these tests is a good sign, but does not guarantee that your program is 100% correct; we run a more substantial set of correctness tests when grading.) Consult the course staff if you do not understand the error message. Q: I receive the error Process took too long and was killed (output may be truncated). What could cause this? A: This usually means that the autograder could not complete in the allocated amount of time. One common cause is an infinite loop. Another possibility is that your program produces an enormous amount of output, perhaps because you left in a debugging statement. Q: What is a readme.txt file? A: It is a plain text file that contains a narrative description of your work. This is the first thing the grader will read. Each week, we’ll provide a template readme.txt file. Be sure to answer any questions that it contains. Q: Which program should I use to edit the readme.txt file? A: Use IntelliJ. Be careful to save the file as readme.txt and not as a .java file. The readme.txt file must be a plain text file. Note, Microsoft Word .doc or .docx formats and Mac TextEdit .rtf formats will not be accepted. Please do not rename your .doc, .docx, or .rtf file to .txt as this will cause your file not to be readable by our system. Q: Which Java programming environment should I use? A: We strongly recommend using IntelliJ for this course. We can only provide support for IntelliJ. Q: How can I download a program from the textbook? A: The booksite contains links to all of the Java programs in the textbook. Each link goes to an HTML file (such as UseArgument.java.html) that is suitable for display in a browser. You can copy-and-paste the code into IntelliJ as needed, with appropriate attribution. The HTML file contains a link to the Java source file (such as UseArgument.java ); you can right click this link and save the file to your computer. Q: How should I read in user input? A: It depends on the assignment. If the assignment specifies command-line arguments, your program should accept command-line arguments; if the assignment specifies standard input, your program should accept input from standard input. You will receive a significant deduction for not following these directions. Q: May I use (advanced) features of Java that have not yet been covered in the course? A: No, your code should use only the Java language features previously introduced in the course. Style Q: How should I format my code? A: Below are some that are particularly important (and for which you risk losing points if you ignore). Do not use a header (a multiline comment at the top of each file), do not include personally identifiable information. Instead, include a one or two line comment at the top of every file to explain what it the Java file does. The course is graded entirely anonymously. This is only possible if you do not also include your name in the files you submit. You do not need to acknowledge your partner in the readme.txt Indent your code consistently. Use four (4) spaces for each indentation level. IntelliJ does this automatically. Under the Code menu, select Reformat Code Do not use hard tabs. Different systems and tools display and print hard tabs differently. Hard tabs are obsolete: in ancient times, they were used for data compression. Modern text editors support soft tabs, which automatically substitute spaces for tabs. If you are using IntelliJ, you are all set. Do not exceed 80 characters per line. Long lines are hard to read and will annoy your grader. Use line breaks as needed. This rule also applies to the readme.txt file. Use whitespace for readability. Insert blank lines to separate logical sections of your code. Insert a space between arithmetic operators. Until you get a feel for what is expected, use the output of Checkstyle as a guide. Q: How should I compose a program? A: Use meaningful variables names. Each variable’s purpose should be obvious from its name, if possible. For example, name a variable isOrdered instead of o or ordered. One common exception to this rule is with loop-index variables: they often have short names, such as i or j. Use straightforward logic and flow-of-control. For example, you should simplify the statement if(isBlue == true) to if (isBlue). Follow directions. For example, if a command-line argument is specified as an integer, read it into a variable of type int; if the assignment says to use a while loop, use a while loop. Follow output formats exactly. If the assignments specifies to print Hello, World, don’t print Hello Moon instead. You should also have the specified number of lines of output. (This means that you should remove (or comment out) extraneously debugging print statements before submitting.) Avoid magic numbers. A magic number is an unnamed numeric constant (other than -1, 0, 1, or 2, used in an obvious manner). Magic numbers make programs hard to debug and maintain. Declare variables to minimize scope. For example, don’t declare a variable to be an instance variable if it is used only as a local variable in one method. All instance variables must be private. Q: How should I comment my code? A: Below are some that are particularly important (and for which you risk losing points if you ignore). Include a brief comment above each code “paragraph.” Some experienced programmers write the comments before they write the code. Outlining or mapping out your program before you code is the best way to make sure you fully understand what the program needs to do and to avoid bugs. But these comments can be succinct (a few words is okay). Include a comment describing every method and class (whether public or private). Include a comment describing every instance variable (including those for nested classes). Project Files Q: How can I extract the .zip file associated with an assignment? A: You must use the project folder with IntelliJ. This is provided as a .zip file. Often associated data files that are useful for testing are included. They are bundled together in a .zip file, which you will need to extract: Zip files on OS X. Download the .zip file listed on the assignment page. In Finder, view the directory containing the downloaded .zip file. Some browsers will automatically unzip the .zip file and create a project folder – which will have the same name without the .zip extension – containing the individual files. (Some browsers may also delete the original .zip file.) Otherwise, if you see the .zip file but no project folder, double-click the .zip file to create the project folder. You will want to create the .java files in this project folder. Zip files on Windows. Download the .zip file listed on the assignment page. In Explorer, view the directory containing the downloaded .zip file. Right-click on the .zip file and select Extract All…, which will ask you to choose the extraction location. This creates a new project folder – which will have the same name without the .zip extension – containing the individual files.. (Do not double click the .zip file—that browses the contents instead of extracting them.) You will want to create the .java files in this project folder. Published with Wowchemy — the free, open source website builder that empowers creators. Cite × Copy Download