Java程序辅导

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

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Programming Assignment Checklist: Hello World Programming Assignment Checklist: Hello World Questionnaire Did you remember to fill out the brief questionnaire? Goals Regardless of the operating system that you choose, the goal of Assignment 0 is to make sure that you can: Find relevant material from the course web page and booksite. Edit, compile, and execute a Java program. Submit your assignment electronically via Dropbox. Note: you won't be able to submit an assignment until you are registered in TigerHub for a precept. Frequently Asked Questions What's a checklist? The programming assignment specifies the general programming assignment. The checklist contains supplemental information, and you are expected to read it prior to submitting your work. Some examples include: links to any preliminary code, a readme.txt template, hints, and frequently asked questions. What preparation do I need to complete this assignment? Read Section 1.1 and 1.2 of the textbook. If you don't understand something, post a Piazza question or visit your preceptor for assistance. Don't be bashful about asking for help. Can I use the booksite instead of the textbook? No, the booksite is a super-condensed version of the textbook; it is suitable for reference while online (for example, while programming). The textbook is intended for use when initially learning new material and when reinforcing your understanding of that material (for example, when reviewing for an exam). How can I download a program from the textbook? The corresponding section in the booksite contains links to all of the Java programs in the textbook. The link goes to a .java.html file (such as UseArgument.java.html) that is suitable for display in a browser. You can copy-and-paste the code into DrJava as needed. The .java.html file also contains a link to the .java file (such as UseArgument.java); you can right click this link and save the file to your computer. I don't understand all of the jargon in HelloWorld.java. Should I drop the course? Don't worry—we'll discover the meaning of everything in the program over the course of the term. Java just needs a lot of boilerplate to get started. Do the readings and bring any lingering questions to precept. Do I have to use DrJava? No, feel free to use any development environment you like. How should I read in user input? Use command-line arguments as specified in the assignment and described in Section 1.2 of the textbook. You will receive a significant deduction for not following directions. We will learn about more general ways to handle user input in Section 1.5. How do I get Java to print true or false without an if-else statement? If b is a boolean variable, then System.out.println(b) will print true or false according to its value. How do I open a plain text file, such as readme.txt? In DrJava, select File -> Open; select the desired directory; choose All Files under File Format. What program should I use to edit the readme.txt file? Use DrJava. 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—Microsoft Word .doc or .docx formats and Mac TextEdit .rtf formats are unacceptable. What's Dropbox? Dropbox is the web-based system you will use to submit assignments. Every assignment has a link to its own dropbox. Look on the Assignments page, in the submit column. You can also go to the general dropbox page via https://dropbox.cs.princeton.edu. Either way, you will need to login. When I login to Dropbox, my browser asks me whether I should accept a "security certificate." How should I proceed? Accept it permanently. We need to establish a secure connection so that you can submit assignments with reasonable privacy. When I submit HelloWorld.java, Dropbox does not seem to accept it. Why not? Be sure the file is named HelloWorld.java. The capitalization and .java extension are important. Also, be aware that DrJava creates backup files with a .java~ extension, so be sure that you don't submit these. If you use Windows, we recommend configuring your system to unhide the filetype extensions. In GreatCircle I understand to use Math.toRadians() and Math.toDegrees(). What about the trigonometric functions? See the Math API on p. 716 for useful math functions and constants. My output from GreatCircle is almost the same as the sample on the assignment page. Only the very last digit is different. Why is there this tiny discrepancy, and is my answer wrong? Did you multiply by 60 (to convert the arc to nautical miles) before or after you converted the arc from radians to degrees? Computers work with limited precision, as the Scientific Computing lecture will explain, and so different algebraically equivalent solutions can give slightly different answers. In grading we ignore such tiny discrepancies (except for certain assignments later where we explicitly tell you otherwise). Submission Submission. All assignments submissions are electronic, using Dropbox. We do not accept email or hardcopy submissions. Here are some guidelines. The assignment (and Dropbox submission form) specifies exactly which filenames to use. These names are case-sensitive (even if your operating system is not case-sensitive). We begin grading your submissions by running an automated script. You will lose a substantial number of points if you don't follow these instructions. Do not submit .class files. Our grading script automatically compiles your .java files. When you submit, be sure to hit the Check All Submitted Files button. Make sure that you submitted the right files and that they compile cleanly. You risk losing a substantial number of points if you submit a file that does not compile correctly. You may resubmit a file after making corrections by uploading the file again. If you plan on submitting your final version after the deadline, make sure your Dropbox directory is empty from the deadline until you submit the final version. Anything in the Dropbox at grading time will be graded as is. Be sure that every file you submit includes your name, login, and precept number. The readme.txt file is a narrative description of the work you did on your program. 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. Programming Style This is a partial list. See Booksite Appendix B for a fuller explanation. Header in every program file. Name, NetID, Precept, and Description. For example: /******************************************************************************* * Name: Kevin Wayne * NetID: wayne * Precept: P01 * * Description: This program prints out the average of the two inputs. ******************************************************************************/ Format your code consistently. Use 4 spaces for each indentation level. DrJava does this automatically. Want to see something cool? Highlight your entire program and press the Tab key. Voila! Auto re-indenting. Do not use hard tabs. (If you are using DrJava, you are all set.) 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. Do not exceed 80 characters per line. Long lines are hard to read and will annoy your grader (who may deduct style points). Use line breaks as needed. This rule also applies to the readme.txt file. Use white space for readability. Insert blank lines to separate logical sections of your code. Clarity comments: a brief comment above each code "paragraph." Write your comments BEFORE you 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. Efficient and clear code: This will be more important as we write more complicated programs. This week it includes ideas like Assign a command-line input to a well-named variable. Do not repeatedly use Double.parseDouble() or Integer.parseInt() inside mathematical expressions. Don't use Math.pow() if all you need to do is square or cube a number. Multiplication is much faster. Follow directions. If an input is listed as an integer, read it into an integer data type. Follow output formats exactly. Use descriptive variable names. Each variable's purpose should be obvious from its name, if possible. Use condition instead of c or oldValue instead of ov. (Only exception: loop variables like i to be introduced next week.) Enrichment Here is Hello World in over 200 different programming languages.