CSC 212 Program # 01 50 points Create a class ConsoleIn to allow type-safe data input from keyboard using Scanner class. Develop methods labeled as read followed by datatype (readByte, readShort, ….) to read a data item of the specific datatype by first testing if the next input token matches the datatype. Pass a string argument to each method to prompt the user with proper message (“Please Enter an Iteger”,…). The layout of the class ConsolIn is provided in next page. Create a program to prompt the user for input of a specific type (use a menu with one option for each basic data type), read the input and report the data item just read and the minimum and maximum value of the data type just read. The basic layout of the client program is provided in next page. Use MIN_VALUE, MAX_VALUE static fields for each data type (Byte.MIN_VALUE, Byte.MAX_VALUE).
View Full
Document
This
preview
has intentionally blurred sections.
ConsolIn class basic layout: public class ConsoleIn { private Scanner scan; public ConsoleIn( ) { scan = new Scanner( System.in );
- Spring '08
- Seyeed
- basic data type, byte data type, option int option
Click to edit the document details