ICS 111, Introduction to Computer Science
Lab 18 - Arrays -
This lab will help the student by:
To receive credit for this lab assignment, you must be finished byThursday, April 8, at 11:59 p.m. After this time you will not receive any credit. Future lab assignments will be due by 11:59 p.m. on the day of the lab assignment.
1. Log in to UH UNIX
2. Write a program to do the following: (Getting Started with Pico)
- Write a program which demonstrates arrays.
- Create an array of 6 strings. This array will be of length 6 with positions 0 through 5.
- The values for these strings will be read from the user.
- Perform the following operations (in order) on the array:
- Print the whole array.
- Print the elements in the even slots.
- Print the elements in the odd slots.
- Add the elements that are numbers.
- Average all the elements that are numbers.
- To determine if an element is a number try using parseDouble.
- All non-numerical elements should be ignored for the sum and average steps.
- The program can be implemented in one class, but should have seperate methods for each of the required operations.
- Note: What you turn in MUST follow the Java Coding Standard rules!
- Before you submit your code, make sure that your code follows the rules of the Java Coding Standard. Visit this link to look up Java code formatting rules and be sure that your program adheres to these guidelines. At least follow the rules of proper indenting / spacing, making a comment block for classes, making a comment block for methods (main method for this lab), and do some inline commenting to explain what your program is doing. Not doing ALL of these will result in a deduction of points on your lab.
- Compile and run the program. Your program must compile without any errors, and must run properly to receive credit for this lab.
3. Get into Pine (Getting Started with Pine, PDF) and attach the file to an e-mail (See pages 11-12 in Getting Started with Pine, PDF)
- control <J>, then control <T> allows you to browse and pick the file that you wish to attach. Only submit the .java file. Do not submit the .class file.
4. Your e-mail should have the following subject: lab X / lastname (the lab number should be substituted for X, and your last name should be substituted for lastname) Not following this standard will result in a deduction of points.
5. Send the file to email@example.com account.
6. Check the webpage to make sure that the e-mail arrived. Note that this will be sent to the ICS 111 lab address (firstname.lastname@example.org). This one is different from the email@example.com. There are two different ones so we can have homework assignments and lab assignments separate.
Here are the URLs:
7. Once I (TA) get the e-mail in my account AND I can verify it on the web, you will receive your lab participation point. For grading policies on your lab, click here...
* Some may argue that it is easier to do this from WebMail or other e-mail programs. If you e-mail your lab / homework from anything besides Pine, it means that you're not positive that it runs / works properly in UNIX. This could result in large point deductions if your program doesn't work properly.
Link to the Java API - to look up any methods of any class you would like to use.
Link to the Java Coding Standard - to look up Java code formatting rules.