Docsity

Lab 1 Instructions for CSC 127A, Spring 06, Lab Reports of Computer Science

Toggle sidebar
bg1
Lab #1 C Sc 127A, Spring 06
Due Date: During your scheduled lab on Tuesday, 17-Jan, or Wed., 18-Jan
To be completed INDIVIDUALLY while in the 930 Gould-Simpson lab during your section
0. Use these instructions to login:
Press CTRL-ALT-DEL. The legal notice will be displayed. Read it. Click OK. This will bring up the
logon window. Enter your username and password. Then click OK. If you have problems logging on,
check that your username and password are correct and that the CSC domain is chosen (if this last option
doesn’t show, click the Options button). Check that caps lock is not on and use the digits across the top of
the keyboard, not on the keypad. The first time you logon, you will be required to change your password
from the first six (6) capitalized characters of your student ID to something else. The password you
choose should be something hard to guess. It must be at least 6 characters long and should contain at least
3 of the 4 following character groups: lower case letters, upper case letters, digits, special characters
(punctuation). Your name or username should not be part of your password. The new password will have
to be entered twice for confirmation.
1. Implement and Run a Welcome Program
·Click the Eclipse Icon to automatically create a folder named workspace on your H: Drive
(if you are in the lab). This is where you will be storing your projects, which you can later access
form any machine in the lab, or from anywhere with an internet connection via a program known
as SSH (available for free to UofA students).
·Eclipse will start and offer a Welcome page, which you should close.
·Create a new project by clicking on File > New > Project
·Make sure Java Project is selected, and then click Next
·After Project Name, enter a name for your project with a name of this form:
Lab1_SectionLeaderName_YourLastName_YourFirstName
·For example, the project name would look like this for Lab1 while in Jessica's section
when your name is Rick Mercer
Lab1_Jessica_Mercer_Rick
pf3
pf4
pf5

Partial preview of the text

Download Lab 1 Instructions for CSC 127A, Spring 06 and more Lab Reports Computer Science in PDF only on Docsity!

Lab #1 C Sc 127A, Spring 06

Due Date: During your scheduled lab on Tuesday, 17-Jan, or Wed., 18-Jan To be completed INDIVIDUALLY while in the 930 Gould-Simpson lab during your section

0. Use these instructions to login: Press CTRL-ALT-DEL. The legal notice will be displayed. Read it. Click OK. This will bring up the logon window. Enter your username and password. Then click OK. If you have problems logging on, check that your username and password are correct and that the CSC domain is chosen (if this last option doesn’t show, click the Options button). Check that caps lock is not on and use the digits across the top of the keyboard, not on the keypad. The first time you logon, you will be required to change your password from the first six (6) capitalized characters of your student ID to something else. The password you choose should be something hard to guess. It must be at least 6 characters long and should contain at least 3 of the 4 following character groups: lower case letters, upper case letters, digits, special characters (punctuation). Your name or username should not be part of your password. The new password will have to be entered twice for confirmation. 1. Implement and Run a Welcome Program · Click the Eclipse Icon to automatically create a folder named workspace on your H: Drive (if you are in the lab). This is where you will be storing your projects, which you can later access form any machine in the lab, or from anywhere with an internet connection via a program known as SSH (available for free to UofA students). · Eclipse will start and offer a Welcome page, which you should close. · Create a new project by clicking on File > New > Project · Make sure Java Project is selected, and then click Next · After Project Name, enter a name for your project with a name of this form: Lab1_ SectionLeaderName _ YourLastName _ YourFirstName · For example, the project name would look like this for Lab1 while in Jessica's section when your name is Rick Mercer Lab1_Jessica_Mercer_Rick

2. Download a Useful File for Input into your Project

· Click on this link to get the existing TextReader class supplied by UofA http://www.cs.arizona.edu/classes/cs127a/spring06/programs/TextReader.java · Save this file to your project, which should be in the folder containing your project. Your folder will be named is something like this (you will need to browse to your H drive: H:\workspace\1_Jessica_Mercer_Rick
· Back in Eclipse, right click on your project and select Refresh (or with Eclipse in focus, press F5). You should see the TextReader class in your project.

3. Create a new Class with a main Method

· Add anew file that will contain class that you will write. Select File > New > Class · After Name: type the name of the class you want to create. For project 1, the first class you create will be called Welcome. After you type that in, click Finish (at bottom).

· Once everything is typed in, save the file by going to File > Save (or Ctrl-S for short). Saving the file compiles the code into a class file and updates the error messages. Fix any errors you may have before you go on. · Next, go to Run >Run As > Java Application · At the bottom of the screen in the Console box, you should see some output that says Welcome. What is your name? · Click on the console window to the right of this prompt · Type in your name and press the enter key o If you can't input anything, try clicking on the line below the prompt as you probably typed println rather than print. The program should respond with Hi your name. I hope you are doing well! · The dialog should look like this (with a different name unless your name is Jane): Welcome. What is your name: Jane Hello Jane! I hope you are well · Make sure you print out the file Welcome.java with File > Print > Click the Print Button · After printing and collecting Welcome.java from the printer (should have the CS watermark), complete these other two problems

5. Implement a Payroll Program in Java

Problem: Write a program that computes the gross pay, for any valid number of hours worked and hourly rate of pay. There is no overtime pay. The dialog should look like this: Hours worked? 42. Hourly pay rate? 10. Gross Pay: 420.

  1. As a section, on the whiteboard, develop an analysis deliverable with variable names, whether they are input or output, and at least one sample problem.
  2. Together on the board, write an algorithm.
  3. Together on the board, write a Java translation of your algorithm (must be very specific)
  4. Everyone at their own computer, in the same project as Welcome, create a new class named Payroll ( File > New > Class ) that has a main method
  5. In Eclipse, retype the Java program you see in front of you.

Grading Criteria ____/ 4 Welcome runs correctly (run it for your section leader) -4 Does not compile -1 Does not have a description of what the program does -1 for any missing output -1 runs but the dialog is quite different than what was shown ____/ 6 Payroll runs correctly for any valid input of hoursWorked and hourlyRateOfPay Note: The output need not be rounded to two decimals. -6 Does not compile -4 For wrong answer -1 Missing prompt for either input -1 Gross pay not labeled Get Grade · Raise your hand so your section leader can grade your first lab according to the criteria below · If you finish early, you may leave · If you do not finish, complete the lab BEFORE at least one day before your next lab and turn it in through web-based turnin.