+ All Categories
Home > Documents > Sep05 - cs. Web view... that you will be doing in “real” assignments throughout the...

Sep05 - cs. Web view... that you will be doing in “real” assignments throughout the...

Date post: 02-Feb-2018
Category:
Upload: hahuong
View: 216 times
Download: 2 times
Share this document with a friend
15
CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015) Homework #0 – Getting Started (Due: Fri day August 28, 2015 ) This assignment consists of activities that are not indicative of the kind of work that you will be doing in “real” assignments throughout the semester, but rather are merely preparatory. 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. Your grade will be either 1 or 0, according to whether or not you submit an appropriate message. If you have difficulties or are unable to complete these activities, I am available to assist you. Before seeking my help, however, you should give it your own best effort and, if you get stuck, seek out classmates, friends, graduate assistants for this course, or the Technology Support Desk (941-HELP). Part I – Register yourself on the “Course Web Page” If you have not yet done so, visit the “course web page” at http://www.cs.scranton.edu/~mccloske/courses/cmps134/index_f15.html , 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 (you will have to invent a password), 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 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. Please take care to remember your password! It is necessary that you complete this registration process because, otherwise, you will not be able to submit your assigned work for this (or any subsequent) assignment. The manner in which you will be submitting such work is described in Part VI. It involves clicking links on the course web page. You will use the same links in order to access my feedback to the work that you submit. Part II – Describe your background For this part of the assignment you are to compose a brief description of your experience using computing devices. I assume that you possess basic computer literacy. (If not, you may wish to take the C/IL 102 course before taking this one.) In particular, if you have ever done any computer programming, indicate how much and in which programming language(s). 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 language. If this is the case with you, take comfort in the fact you likely will be in the majority. Use Wordpad, Microsoft Word, or some similar tool to prepare this description and save it in a file. It should be a paragraph or two in length and be well written R. McCloskey Page 1 of 15
Transcript
Page 1: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

Homework #0 – Getting Started (Due: Fri day August 28, 2015 )

This assignment consists of activities that are not indicative of the kind of work that you will be doing in “real” assignments throughout the semester, but rather are merely preparatory. 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. Your grade will be either 1 or 0, according to whether or not you submit an appropriate message.

If you have difficulties or are unable to complete these activities, I am available to assist you. Before seeking my help, however, you should give it your own best effort and, if you get stuck, seek out classmates, friends, graduate assistants for this course, or the Technology Support Desk (941-HELP).

Part I – Register yourself on the “Course Web Page”

If you have not yet done so, visit the “course web page” at http://www.cs.scranton.edu/~mccloske/courses/cmps134/index_f15.html, 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 (you will have to invent a password), 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 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. Please take care to remember your password!

It is necessary that you complete this registration process because, otherwise, you will not be able to submit your assigned work for this (or any subsequent) assignment. The manner in which you will be submitting such work is described in Part VI. It involves clicking links on the course web page. You will use the same links in order to access my feedback to the work that you submit.

Part II – Describe your background

For this part of the assignment you are to compose a brief description of your experience using computing devices. I assume that you possess basic computer literacy. (If not, you may wish to take the C/IL 102 course before taking this one.) In particular, if you have ever done any computer programming, indicate how much and in which programming language(s).

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 language. If this is the case with you, take comfort in the fact you likely will be in the majority.

Use Wordpad, Microsoft Word, or some similar tool to prepare this description and save it in a file. It should be a paragraph or two in length and be well written (i.e., using proper grammar and coherent sentences), such as would be expected of a capable college student.

Although this file could be attached to an email message and sent to me, I do not want you to do that! Instead, you are to send the file to me via the “Submit/Review” link provided on the course web page adjacent to the link that brought you to this document. Instructions appear in Part VI, near the end of this document.

Part III – Installing J ava and jGRASP on your own Personal Computer

As a necessary prerequisite to developing computer 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, as well as an IDE (i.e., Integrated Development Environment). Several suitable IDEs exist, but the

R. McCloskey Page 1 of 14

Page 2: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

one that I recommend for use in this course is jGRASP. (Installation programs for both Java and jGrasp can be downloaded from the Internet for free. Detailed instructions appear below.)

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 to you. (If you are given a choice for some option, it’s usually safe to pick the recommended or “default” option.)

Although some of the steps are detailed, there are important concepts behind these details that are worth discovering, even if the details remain a nuisance. The details often 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 any other software for that matter) on any public computer anywhere on campus. These software tools are already available on the machines in LSC 182 as well as some other labs on campus. Attempting to install such software in a public lab is likely not to work and may cause problems that employees from the University’s IT department will have to fix later.

As a duly registered student in a CMPS course, you are authorized to use the computers in LSC 182 (conveniently located across the hall from the offices of several Computing Sciences faculty), which is a lab where computing students gather to work on course projects. Your login ID there corresponds to your University ID (e.g., “smithj2”) and your initial password is your Royal Number (with an upper case ‘R’). Card swipe access should be operational by early in the semester.

Part IIIa – Installing Java

Java comes “pre-installed” on the Mac “platform”, so Mac users can skip this part and go directly to Part IIIb. Most of the rest of us use the Microsoft Windows platform, so what follows is geared towards that group. If you happen to use some other platform, you should look for versions of the relevant tools (Java JDK and jGrasp) available for it. (You may very well find them at the same web sites where versions for Windows exist, so keep reading.)

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 translates Java “source” code into Java “bytecode”, and the Java Run-time Environment (JRE), which executes Java bytecode.)

Go to the course web page and click on the link labeled Java SE 8 JDK Download (which you’ll find under the heading Java-related links). On the (Oracle Corporation) web page that appears, click on the “Download” button directly above the label Java Platform (JDK) 8u60. The page that appears next has a list of names of downloadable files within a table with the heading Java SE Development Kit 8u60. Click on the Accept License Agreement radio button. If your computer has a 32-bit processor architecture, click on the file name jdk-8u60-windows-i586.exe (2nd from the bottom). If it has a 64-bit architecture, click on jdk-8u60-windows-x64.exe (bottom-most).

Note: To determine your computer’s architecture (32-bit vs. 64-bit), you can “ask” it. If your machine is running Windows 7, do this: click the Start button, then right-click Computer, and then click Properties. The information presented should provide the answer. If your machine is running Windows 8, do this: click the icon at the bottom left of the desktop (bringing you to the “start screen”), then click the down arrow to bring up the “apps screen”, then within the “Windows Systems” group (way on the right) click on “Control Panel”, then click “Systems and Security”, and finally click “System”. For Windows 10, ask someone! End of note.

Once you’ve clicked on the correct file name and downloaded the file onto your machine’s hard disk drive, double click on the file’s icon in order to begin the installation. (Be sure to take note of where the file has been stored (i.e., which folder/subdirectory) so that you can find it.)

R. McCloskey Page 2 of 14

Page 3: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

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 folder will have a folder 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.) If you can find these files in this location, you can be reasonably sure that you have completed this step satisfactorily.

Part IIIb – Installing jGRASP

Click on the link labeled jGrasp IDE on the course web page (under “Java-related links”). Near the upper right corner of the page that appears will be a link labeled Download jGRASP. Click on it, and on the resulting page scroll down a little to find the first button that says jGRASP.exe (or jGRASP.pkg for a Mac). Click on that in order to download the installation program for jGrasp. Then run that program. Again you may need to accept the license agreement and you are encouraged to accept the default settings as you proceed. jGRASP is provided by Auburn University and it is frequently updated with new releases. As was the case with the Java JDK, any of the recent versions will be fine for our use this semester.

Part IV – Testing Java and jGRASP

Go back to the course web page and download the HelloWorld program. (You’ll find a link to it under the heading “Programming Samples”.) Before doing so, you may want to create a folder (named cmps134, perhaps) for storing the Java programs that 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.

R. McCloskey Page 3 of 14

Page 4: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

As you can see, the interface is very similar to most windows based programs. After navigating to the folder into which you downloaded the HelloWorld program, click on the “File” menu, select “Open”, and choose the file HelloWorld.java. The screen should now look something like the following.

R. McCloskey Page 4 of 14

Page 5: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

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

green plus sign .

In response, a message similar to the following should appear in jGrasp’s console (bottom) window.

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 and it should reside in the same folder/subdirectory as HelloWorld.java.

Assuming that your compilation was successful, you can start the execution of the HelloWorld

program by selecting the button that looks like a running stick-figure person . Selecting this button should result in a screen that looks like the following. Take special note of the console window (at the bottom) which now should show the result of (i.e., the output produced by) running the program.

R. McCloskey Page 5 of 14

Page 6: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

If you obtained this result (namely, the string “Hello World” is displayed), 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 programming task, modify the given HelloWorld.java program so that, in addition to outputting the message “Hello, World.”, it also outputs “Goodbye, Universe.”. To achieve this effect, you merely need to insert an additional statement into the program, immediately after

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

It is left for you to compose that statement.

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, and the particular instructions and screenshots apply to Windows 7. Windows 8 and Windows 10 users will have to translate the instructions to analogous ones that work on that platform. Others should skip to Part VI.

Part Va – Changing the Path Variable

To change the Path variable, first you need to determine exactly where in your file system Java has been installed. Typically it will be in a folder named as illustrated in the following screen shot; in this case, C:\Program Files\Java\jdk.7.0_02\bin. Specifically we need to locate the files named javac.exe and java.exe, which are both in the folder.

R. McCloskey Page 6 of 14

Page 7: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

Now open the “Control Panel” on the Start Menu.

R. McCloskey Page 7 of 14

Page 8: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

Then select “System and Security”.

Here select “System”.

R. McCloskey Page 8 of 14

Page 9: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

Then select “Advanced System Settings”.

In the System Properties window select “Environment Variables”.

R. McCloskey Page 9 of 14

Page 10: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

In the System Variables area, locate the variable named “Path”.

After clicking the “Edit” button, advance to the end of the text in the Edit System Variable box. At this point enter a semi-colon followed by the full path name to the folder in which Java was installed (i.e., the one containing the Java files java.exe and javac.exe). In the screen shot below “;C:\Program Files\Java\jdk1.7.0_02\bin” has been appended to the end of the Variable value.R. McCloskey Page 10 of 14

Page 11: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

After doing this, click “OK” all the way back to the Start Menu.

R. McCloskey Page 11 of 14

Page 12: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

Part Vb – Testing the change to the Path Variable

Go to the course home page and, under the Programming Samples heading, click on the link labeled MeanProgram . Download this program into the same folder as you did the HelloWorld program.

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

2. Change the directory (a.k.a. folder) to the one into which

you downloaded MeanProgram.java. In my example here, I’ve named the directory C134, and so the command I typed was:

cd c:\C134

At the prompt, type in the command

javac MeanProgram.java

This command invokes the Java compiler. Assuming that the Path variable was changed correctly (and that a file named MeanProgram.java resides 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.

R. McCloskey Page 12 of 14

Page 13: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

3. If step 2 was successful, then 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 the “average”) of the values you previously entered. If the program executes as outlined here then you clearly have changed the path variable correctly.

If you receive error messages then this probably indicates that the path variable has not been changed correctly. If however, jGRASP was installed correctly you should still be able to open, compile and run the MeanProgram.java file as illustrated earlier for the HelloWorld.java program. If this works then all is well ---maybe not perfect--- but well.

Part VI – Submitting your Message and Background Document

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:

R. McCloskey Page 13 of 14

Page 14: Sep05 - cs.  Web view... that you will be doing in “real” assignments throughout the semester, ... done any computer programming, ... ready for Programming Assignment 1,

CMPS 134 – Fall 2015, HW #0 (Due: Friday August 28, 2015)

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” text box 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.

Fill in the Message textbox with a sentence or two 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, which is where you need to be.

You are to use the “File” fields with their accompanying “Browse” buttons to “attach” the MS Word (or Wordpad, or whatever) 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 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.

R. McCloskey Page 14 of 14


Recommended