CS99 |
Fundamental Programming Concepts
Summer 2001 |
|
Lab
1
|
|
Overview | |
This lab will involve several Internet tasks and a small
Java program. The goal is to introduce you to the Internet resources available
in this class and help you to become accustomed to using these resources.
You will:
Note that if you're reading this handout on a printed page, rather than online, you'll frequently see underlined words. These are hyperlinks that, when viewed online, can take you to pages with more information. |
|
Part I: The Course Web page | |
The programs we'll be using in lab to access the Internet are supplied through Bear Access, a suite of programs that Cornell makes available. In Upson B7, you can start Bear Access by using the Start menu: Start->Programs->Bear Access->Bear Access via Runway. Bear Access supplies Netscape Communicator for a web browser, Eudora for email. You may use Internet Explorer to access the Web page too.
|
|
Part II: Java | |
For this course we will be using a compiler called CodeWarrior
that is made by Metrowerks. It is an IDE, which stands for Integrated Development
Environment. This means that the editor, compiler, and debugger are all
part of one big program.
Creating the ProjectYou will need to create a CodeWarrior project for each program you write. A project can contain several source files, libraries, and other items. To create a project for this lab, follow these instructions.Don't forget that when you're done working for the day, you'll need to copy your project to a disk, and then logout of the machine you are working on (Start->Logout). Your First ProgramNow that we have the project created, let's write some code! Enter the following code in the Lab1.java file:/** Absolutely everything is important -- the spelling, capitalization, punctuation, etc. Now try to run your program. You can do this by doing any of the following:
If all goes well, you'll soon see a message on the screen saying "Hello, world!". Congratulations! You've written your first Java program. If not, you have your first bug to fix. The compiler will show you a list of errors. You can click on each error in the list, and it will take you to the statement in the program that the error is in. Try to figure out what you did wrong, correct it, and then try running the program again. By the way, println is a method that prints a message to the screen.
Its name stands for "print line". It is a method that belongs to the System.out
object. We'll talk more about objects later. Your Second ProgramNow it's time to write your own program -- the real one for this lab. This is the program you will submit. To prepare for it, keep your Lab1 program open. Get rid of all the statements inside main.Write code that prints your initials to the screen. It should look something like this: A JJJJJ RRR A A J R R A A A J RRR A A J J R R A A JJJ R RYour letters should be at least 5 rows tall. It should print to the screen the secret phrase that you found on the course Web site in Part I. Now rewrite your main method so that you the output is the following:
That's the first secret phrase, a blank line, the second secret phrase, a blank line, and then your initials. The blank lines can be produced with the following call to println: System.out.println();This is the only kind of call to println that your main method is allowed to make. Note that you could also make another method to do this, if you wanted. The program will be graded on these criteria:
Print a copy of the file Lab1.java as well as the output from the program. |
|
Part III: Email and Newsgroup | |
For this part of the lab, you will need to have your Cornell
NetID and password. If you don't have these yet, you'll need to go to the
CIT helpdesk located at the CCC building, and bring a photo ID with you.
|
|
Part IV: Submit Your Lab | |
To submit your lab, follow the instructions
on the separate handout about submitting labs.
Files to submit:
|