ICS 111, Introduction to Computer Science
Lab 15 - Counting Characters - March 9
This lab will help the student by:
Note: The login / password that you signed up for is for using the computers in the lab this semester. Please write down your username and password and keep it in a safe place, since you will need this for every lab this semester.. This user name / password is only for gaining access to the lab computers, and has nothing to do with logging into UH UNIX. Also, be careful and make sure that you logout from the computers when you leave the lab or other persons may see your stuff or use your account to do "bad" things.
Instructions:
To receive credit for this lab assignment, you must be finished by
Thursday, March 11, 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 the program described on page 63 of your lab manual. You do not have to follow this exactly- you can be creative.
- The specs can be changed a little bit as follows:
Have 4 methods callable from the main method. Print out a menu and ask the user to choose what they would like to do.
method 1
public static int countBlanks(String sInput ) it will return the number of blanks in sInput
method 2
public static void countVowels(String sInput ) it will print the number of a, e, i, o and u found.
method 3
public static int countChar(String sInput)
//reads the character inside the method
method 4
public static int countChar(String sInput, char c)
//sends the character to be counted as a parameter
There should be a loop in your main method as specified in step 5.
- Before you submit your code, make sure that your code is formatted cleanly. Every time you open a new {, you should indent everything two spaces underneath it. For example:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
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 ics111-lab@hawaii.edu 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 (ics111-lab@hawaii.edu). This one is different from the ics111-homework@hawaii.edu. There are two different ones so we can have homework assignments and lab assignments separate.
Here are the URLs:
http://www2.hawaii.edu/~tp_200/bmf/ics111-homework.html
http://www2.hawaii.edu/~tp_200/bmf/ics111-lab.html
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.