Sep05



Homework #0 – Getting Started (Due: 6pm Tuesday August 31, 2010)

This assignment consists of activities that are not indicative of the work to be done on “real” assignments, but rather are merely preparatory to what we will be doing throughout the semester. Upon completion (more or less) of these activities, you are to submit a message to me in accord with the instructions that appear in Part VI, near the end of this document. I plan only to record receipt of your message; you will not be assigned a grade.

If you have difficulties or are unable to complete these activities, I am available to assist you as appropriate. I should not be your first line of assistance, however. You should give it your own best efforts first, secure other assistance (classmates, friends, Help Desk, etc.) as appropriate, and then see me if necessary.

Part I – Register on the “Course Web Page”

If you have not yet done so, visit the course web page at , select (under the heading “Student Functions”) the hyperlink labeled “Register”, enter your Royal number (upper case R followed by eight digits), click on “Submit Form”, enter the requested data (only the password is required), and then click on “Submit Form” again. After it responds that you have become authorized, verify it by navigating back to the course web page (e.g., by using the web browser’s BACK button) and selecting “View Class Roster”. Your name should appear on the list when you click on the “Select” drop-down menu.

It is necessary that you go through this registration process because all assignment work (including the message that you are to create for this activity) is to be submitted electronically to me via the course web page.

Part II – Describe your background

For this part of the assignment you are to compose a brief explanation of your computing background. In particular, I’m interested in knowing whether or not you have ever programmed and, if so, which programming language(s) you used.

CMPS 134 is an introductory course, so don’t be concerned if you do not know exactly what is meant by “programming”. Typically, more than 75% of students who enroll in it have never programmed before and thus are not familiar with any programming languages. If this is the case with you, take comfort in the fact you likely will be in the majority.

Use Microsoft Word (or some equivalent tool) to prepare this explanation. It should be a paragraph or two in length, include your name and the date, and is expected to be properly written (i.e., using proper grammar and coherent sentences, such as could be expected of a capable college student).

Although this explanation could be attached to an email message and sent to me, I do not want you to do that! Instead, this assignment requires that you communicate your explanation to me via the “Submit/Review” link provided on the course web page adjacent to the link that brought you to this document. This is detailed in Part VI, near the end of this document.

Part III – Installing Java and jGRASP on your Personal Computer

As a necessary prerequisite to developing programs for this course, you will need to have access to a “programming environment” that aids the user in creating, modifying, and executing programs written in the Java programming language.

If you have a personal computer and intend to use it for work in this course, you should install Java and an IDE (i.e., Integrated Development Environment). Java is the programming language that we will use in the course, and jGRASP is the IDE that I encourage (but do not require) you to use. (In several weeks I may encourage you to install another IDE, but you need not concern yourself with this now.).

The software tools we need are available on the disk that comes with the course text (Building Java Programs – 2nd Edition, by Stuart Reges and Marty Stepp). They are also freely available online as downloads. A link to each one is provided on the course web page under the heading “Java-related Links”.

If you have little or even no experience installing software, this assignment will benefit you in that it will require you to deal with some issues that you may not have encountered before. Generally, one installs software by “running” an installation program and then following the instructions and answering the prompts that are presented.

Although some of the steps are detailed, there are important concepts behind these details that are worth discovering, even though the details remain a nuisance. The details constantly change, but the concepts persist, and this is a vitally important point to learn about computers and computing.

Do not attempt to install Java (or jGrasp, or anything else for that matter) on any public computer anywhere on campus. These software tools are already installed in STT 488 - Plonsky Lab and in some other labs on campus. Attempting to install such software in a public lab may cause problems that employees from the University’s IT department will later have to fix.

Part IIIa – Installing Java

Since the majority of us use the Microsoft Windows “platform”, this write-up is geared towards that group. If you happen to use some other platform, you are directed to look for versions of these tools available for it. (If you have questions or run into any difficulty, see me and I will try to help you ---or to direct you to someone who can.) Mac users should not have to worry about installing Java, because it comes “pre-installed” on that platform. (Thus, Mac users can skip past Part IIIa and go directly to Part IIIb.)

In order to be able to develop and execute Java programs on your computer, you will need to install the “Java Development Kit”, or JDK. (It includes both the Java compiler, which can translate Java code into Java Bytecode form and the Java Run-time Environment (JRE), which can execute Java Bytecode.)

Place the textbook’s CD into your computer’s CD drive. In its subdirectory (i.e., folder) named JDK you will find an installation program named jdk-6u18-windows-i586.exe. If your computer has a 32-bit processor architecture, execute it (by double clicking). If, on the other hand, your computer has a 64 bit processor architecture, go to the subdirectory JDK_FOR_64BIT_BROWSER (which is nested inside the JDK subdirectory) and execute the installation program there, jdk-6u10-windows-x64.exe. If you don’t know which of the two architectures applies, choose the installation program for the 32-bit version, which should work in either case.

During the installation, you’ll need to accept the license agreement and make some choices as to settings. For the latter, I encourage you to choose the default settings. The installation may take several minutes.

Eventually you should receive notice that the process is complete, at which time you should click Finish. Your browser may open and present you with a page on which to register Java, but there is no need to do the registration.

During the installation process, take particular notice of the step that shows precisely where (i.e., in which subdirectory/folder) in your computer’s file system Java is being installed. Most likely it will be in

C:\Program Files\Java\jdk??????

where the ?’s will refer to the exact version number of JDK you are installing. When installation has finished, this subdirectory will have a subdirectory within it named “bin” that contains (executable) files named javac.exe and java.exe, which are the Java compiler and the JRE, respectively. (By convention, names of executable files end with the .exe extension.)

Part IIIb – Installing jGRASP

The textbook CD also contains a subdirectory named AdditionalIDEs and within it a subdirectory named JGrasp containing a single executable file. Run this file to begin the installation. Again you may need to accept a license agreement and you are encouraged to accept the default settings as you proceed.

Part IV – Testing Java and jGRASP

Go back to the links on the course web page pertaining to this assignment and download the provided example program, called HelloWorld.java. (Before doing so, you may want to create a folder (named cmps134, perhaps) for storing the Java programs you will be working on in this course. Don’t make the common mistake of placing all your files “on the desktop”, as soon it will become very cluttered and disorganized.)

Now start jGRASP by clicking the icon on the desktop or finding it on the Start Menu. Your screen should now look something like the following, indicating that jGRASP is running.

[pic]

As you can see, the interface is very similar to most Windows-based programs. After navigating to the right subdirectory, click on the “File” menu, select “Open” and choose the file (HelloWorld.java) that you just downloaded from the course web page. This will load the file into jGRASP. The jGrasp window should now look something like the following.

[pic]

The window just opened presents to you a complete (although small) Java program. This program contains instructions to have the computer print out the message Hello, World. Before it can be executed, we need to “compile” it, which means to translate it into a binary form (namely, Java Bytecode) that the JRE can “understand”. To compile, select the button that looks like a plus sign [pic] .

In response, the following message should appear in jGRASP’s bottom window.

[pic]

If you do not receive such a message, it may mean that the Java compiler (one component of the JDK) has not been correctly installed. The Java compiler is itself a program that performs the task of translating Java “source code” (e.g., the contents of the file HelloWorld.java) into instructions expressed in a binary form (Java Bytecode) that the JRE is capable of executing. A successful compilation results in the creation of a Java “class” file (containing Java Bytecode); in this case, its name should be HelloWorld.class.

Assuming that your compilation has been successful, you can start the execution of the HelloWorld.java program by selecting the button that looks like a running person [pic].

Selecting this button should result in a screen that looks like the following. Take special note of the bottom window, in which now should appear the output resulting from running the program.

[pic]

If you obtain this result then it is clear that both jGRASP and Java have been installed and you are now ready to begin doing the “real” assignments of this course.

As your first step in programming I ask you to modify the given HelloWorld.java program and have it, in addition to outputting the message “Hello, World.” also output the message “Good-bye, Universe.”. To make the program do this you merely need to insert an additional statement into the program, immediately after the

System.out.println("Hello, World.");

statement that is already there.

Part V – Changing the Path Variable (optional)

After completing the instructions in this section, you will be able to invoke the Java compiler and the JRE from a “Command Prompt” window much more easily than you can now. Having this capability is simply a convenience, not a necessity. Moreover, if you make a mistake in carrying out this task, you may “mess up” your computer in such a way that restoring its functionality is a major nuisance. Hence, completing the instructions in this section is optional and is recommended only for students who are confident in their skill in working with computers. Computing majors are encouraged to make the attempt because they have a particular interest in gaining such skills and confidence.

Note that this part is relevant only to those using Microsoft Windows. Others should skip to Part VI.

Part Va – Changing the Path Variable

In order to be able to invoke the Java compiler and JRE from the command line without having to type in complete path names (e.g., C:\Program Files\Java\jdk1.6.0_18\bin\javac), it will be necessary to change the “Path” environment variable on your system. To do so, open the “Control Panel”. (To get to it, go through the Start Menu, possibly going through “My Computer” as an intermediate step.) The following screen shots are from a MS Windows VISTA environment, but the process for MS Windows 7 or MS Windows XP should be essentially the same (even though the screen images and some of the details will be slightly different).

Then select “System”.

Then select “Advanced System Settings”, which may require you to select the “Continue” button when prompted with the dialog box indicating that “Windows needs your permission to continue”.

From “System Properties” select the “Advanced” tab and then the “Environment Variables” button.

Scroll down the “System variables” and find the one named “Path”, select it and then select the “Edit” button.

Here you must be very careful not to mess things up. In the associated “Variable value” textbox, navigate to the end using the right arrow key and there type in the (full) name of the subdirectory in which Java was installed, preceded by a semi-colon. For example, if you installed JDK version 1.6.0 Update 21 (see Part IIIa), this might be as follows:

;C:\Program Files\Java\jdk1.6.0_21\bin

Now, select the “OK” button for each dialog and window until you are back at the desktop.

Part Vb – Testing the change to the Path Variable

Go to the course web page and find the hyperlink to MeanProgram. Click on it and save the file (named MeanProgram.java) in the subdirectory where you keep the files relevant to this course.

1. From the “Start Menu” open a “Command Prompt” window. You’ll probably find it under “All Programs” and then “Accessories”.

2. Change the “current directory” to the one in which you stored MeanProgram.java. For example, if that subdirectory is C:\cmps134, you would enter the command

cd c:\cmps134

At the prompt, type in the command

javac MeanProgram.java

[pic]

This command invokes the Java compiler. Assuming that the Path variable was changed correctly (and that a file named MeanProgram.java is in the current directory), the result should be the creation of a file named MeanProgram.class, also in the current directory. You can verify this by entering the command “dir”, which lists the names of files in the current directory.

If you receive an error message to the effect that “’javac’ is not recognized as a command”, this probably indicates that the Path variable was not properly changed. It does not necessarily mean that Java has not been installed. You should attempt to resolve this by repeating Part Va.

3. If step 2 was successful, type in the command

java MeanProgram

This will cause the specified program to begin running. The program will repeatedly prompt you to enter an integer value. When you enter the value zero, the program will display the (arithmetic) mean (i.e., what is often referred to as “average”) of the values you previously entered. If the program executes as outlined here then you clearly have changed the path variable correctly.

Part VI – Submitting your Message and Background Document

The activities outlined here are intended to get everyone started doing something and to prepare our computers and ourselves for the work we will be doing. Under the heading “Homework Assignments” on the course web page is the link to this document. Next to that link is one labeled “Submit/Review”. Clicking on it takes you to a page that looks somewhat like the following:

[pic]

This will be the standard form to be used to submit work for the assignments in this course. The form requires a “Title”; something simple, such as “Homework 0”, is recommended. The “Message” area allows you to enter a brief narrative, but it has limited functionality. For example, there is no spell checking and you must enter “hard returns” in order to format lines for readability.

For this assignment, compose a brief message indicating the degree of success you’ve had installing and testing the software. Are you at a point where you can compile and run the given Java programs using jGRASP? If so, then you are ready for Programming Assignment 1 when it comes, and that’s really all I need to know from you at this point.

You are to use the “File” fields with their accompanying “Browse” buttons to “attach” the MS Word file you that prepared in Part II. This should be the only file that you attach.

Note that this simple form, although appearing similar to an email message, is functionally different. The title, message, and files you submit are transferred to me and placed in a folder of which I am owner. These files, plus any files that I may add to the folder (which is the means I typically use to provide feedback to you on your work) are available for you to “review” online at any time. In this sense, reviewing means that you are able to download, and then “view”, but not to modify these files. Be assured that these folders containing your submissions and my feedback are stored in a protected way so as to be accessible only by you (through the authorization you activated when you registered) and me.

Good luck, and I will be looking for your submissions.

R.W.M.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery

Related searches