COMP 110-003 Spring 2013

Lab 2

10 Points

Description

Lab 2 will introduce you to Java applets, string manipulation, and type casting. You have been given a skeleton program StringFun.java that can be found on the course webpage. Copy the program into Eclipse (You will need to create a new Java Project called lab2 and a new Java Class called StringFun), and compile and run the program.

Part 1

Characters are stored as numbers in a computer. This java applet converts the input integer to the unique Unicode character stored as that number. Appendix 7 has a subset of the Unicode character set. Note: the input integer was type cast as a character.
(char)inputInt

Type casting is more commonly done between integers and floating-point numbers. Often when performing arithmetic operations between the two types.

Part 2

For this part of the lab you will modify the code StringFun.java to prompt the user for a string (of characters) and output information about the string as well as manipulate the input string. You will be referencing Section 2.2 of your textbook.

Part 3

Modular Arithmetic (Solve these problems, Remember you are calculating the remainder)

Check your answers in a Java program if you are unsure.

Grading

I will check the screen output on your computer during lab time(this one or any one in the future). Each hollow circle bullet in Part 2 is worth 2 points. You are not allowed to cooperate. The exception is that you can discuss the algorithm for the last bullet. There is no specific deadline but start early so that you'll not miss Lab 3's deadline (Lab 3 is based on Lab 2 and you will submit Lab 3 through Sakai.)