CS 312 - Programming
For your first assignment, please visit the microlab in
Painter Hall, room 5.38 during your
discussion section, or any time prior to the due date. During your
first discussion section, your TA will be in the lab
to help you with this assignment. If you complete this assignment
discussion, you do not need to attend the first discussion section
You will do the following:
- Carefully read the general programming assignment requirements on
- Obtain a CS lab account before your discussion section meeting:
follow the prompts. Ideally you should do this soon, as it
takes at least one full day (and sometimes longer) for your account to
be activated. You must remember
the account name and password you choose - they will not be emailed to
you. You will use this account to turn in your files, even if you do
not work in the lab.
- Join the class piazza group (the link is on the main course web
page). You should check messages on this group regularly - I
will assume you have read any announcements that are posted on it. Ask
and answer questions related to course material here. Never post
solutions to class exercises. You might also want to use the class
yahoo group to find a study group.
- If you plan on working from home during the semester, download
Java onto your computer using the instructions on the CS
312 software page. You will probably want to use an IDE when
programming assignments; I recommend that you use blueJ. Download
blueJ on your computer.
- Successfully login to a computer in the Elements Lab.
- Start BlueJ: On the lab PC, click Start button, then select
Programs, and click on BlueJ. If you do not find it, do not hesitate to
ask the TA.
- Create a Project: Go to Project -> New Project. In the File
Name field, type Lab1
for the project name and click on
the Create button. The Project window will open and you will see
buttons on the left that say "NewClass", "Compile", etc. On the right,
you will see a graphical window that contains a file object icon.
- Create a Class: Click on the New Class button. A New Class
dialog box will open. Type "LittleLoop" in the Class Name field. Leave
the class option selected and click OK. In the graphical window, you
should now see a new object called LittleLoop. Double-click the
object to open it. This is going to be your LittleLoop.java
file. You have a template to work with, most of which you will modify
for your purpose.
- Type in the LittleLoop
program, just as you see it here.
not necessary that you
understand all the terms in this program. It will be explained to you
in class later.
- Save your Program: Go to Class -> Save to save this file.
- Header: You need to create a header for this file (it is
already in the file you were given to copy). These are
some comments you put in the program to make the program more readable
to you and identifies your work to the TA. The header will be commented
out and needs to go before the main body of the program. For your CS
312 programs, you will use a header like the one in the LittleLoop
- Once you have created your header, you can save your class again
(Class -> Save). Always save your program after any changes. This
avoids any loss of work.
- Compile: Click on the Compile button at the top of the file
editing window. If there is an error, make sure you did not make any
typos and try compiling again.
- Run your Program: Close the editing window so that you are back
at the main window. Right-click on the littleLoop class (yellow box
labeled littleLoop) and select the "void main(args)" option. You will
get a pop up box. Click OK. This will run your program and show you the
output generated. If everything looks okay close the run window.
- You can find the saved file under the directory created for your
project. Since your project was named using your username, then you
should be able to find the file in the directory named by your username
on the computer's hard disk (i.e. C drive). For example, it will
probably be in C:\your_user_name. Make sure the file name that contains
your Java source code is LittleLoop.java.
- Read the instructions on how to submit your program with
- Submit your finished LittleLoop.java file according to the
turnin instructions. The file should contain the following
- The proper header (you will need to fill in the requested
- The java source code for the LittleLoop program (it should
look exactly as it does in the copy above)
- Close BlueJ: Make a backup of your littleLoop.java file on your
memory stick and then logout of the computer. Always save your
BEFORE logging out - once logged out all your information is lost
saved elsewhere. You can save your file on a memory stick, or by
emailing the file to yourself, or by using the turnin program. But
don't log out before you save your program.
Did you remember to:
- review the assignment requirements?
- work on this assignment individually?
- fill in the header to answer the questions in your file
- check for compile errors and runtime errors in your program?
- turn in your Java source code, your file LittleLoop.java to your
cs 312 folder via the turnin program?
- submit your program by the due date at 11 pm?