Thursday, July 30, 2009

Java program?

Hi, can any1 plz solve this java program:





Q. Write a Program with the following class description:


class name : format


1. Data members : str // Stores string


len //length of the string


2. Format() //contructor


3. void readstring() //reads in the string


4. char charar(int index) //returns character at index postion


5. void writechar(char c) //writes character to output


6. void change() // writes changed case character to output


7. int isupperc(char c) // returns 1 if c is uppercase


character and 0 otherwise

Java program?
class Format {





private String str;


private int len;





public Format( String s ) {


str = s;


len = s.length():


}


public int iswhoppercase( char c ) {


int anyOldCharAsANumber = (int)c;


return (Character(anyOldCharAsANumber).isType() == Character.UPPER_CASE) ? 1 : 0;


}


private char charar( int theNum ) {


return str.charAt(theNum);


}


}





class MainApp {





public static void main(..


Format f = new Format("Dubya KoolDaddy");


int x = f.isawhopper(f.charat(0));


}


No comments:

Post a Comment