This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment 3
6 June 2000
Due: Tuesday, June 6 at midnight
Late penalties: 20 points per partial day late. That is, programs
turned in after midnight Tuesday and before midnight Wednesday
will have 20 points deducted for late, programs turned in after
midnight Wednesday and before midnight Thursday will have a total
of 40 points deducted for late, etc.
Total point value of assignment: 100 points
Late submissions not accepted after: Friday, June 9 at midnight
This assignment is to be done INDIVIDUALLY.
Create a directory, A3, which will contain all parts of this assignment.
(In this assignment the directory A3 will contain a single file
named Asg3.java.)
The objectives of this program are to give you some more experience working
with Strings and developing logic to solve a frequently encountered
situation.
Input:
Input should be read in the ConsoleWindow.
Request the user to enter an integer. This integer will be read
from the screen with the readString method (in the ReadStrem
class) and stored in a variable of type String.
Output:
Print your name, the assignment number, and a short description
of the assignment to the screen.
Print the String read from the ConsoleWindow. (Printing the
value read in checks that you actually read the value you expect
to read. This is called "echo printing.")
Print the integer value that results from processing the
String.
Other requirements:
The String supplied by the user may be positive, zero, or
negative. Sample input values are "32", "5603", "-15", "0",.
Your program should handle any of these correctly.
Your program should also detect illegal characters in the
input. Illegal input might consist of "-a", "word", or "$53".
However, initial digits followed by letters should be treated
as if only the initial digits were read. Thus "1024L" should
be treated as "1024" and "-7H" should be treated as "-7".
Follow the style standards to be found on your instructor's
web page for CPSC 210.
Submit your program using the handin command. There is a link to
the handin description on your lab page (www.cs.clemson.edu/~lab210).
Grading rubric:
In the opinion of the instructor the program is an honest attempt
to complete the assignment as described 10 pts.
If the above requirement is met:
Required documentation 10 pts.
Style standards 20 pts.
If the two previous requirements are not met, no further points
will be awarded.
The program compiles without error. 10 pts.
The program compiles without error, and detects illegal input
that begins with a symbol or than a digit (or other than a
- followed by a digit). 10 pts.
The program compiles correctly, and correctly extracts a
number (or - followed by a number) from non-digits that follow.
10 pts.
The program compiles correctly and correctly converts an
input string (consisting of digits) to the equivalent integer.
(20 points if works for non-negative. Additional 10 points
if works for negative.)