PROGRAM INDENTATION
Project Group :
Kiran Pandey(Y2180) -B4- kiran
Neha Sugandh(Y2233) -B4- sneha
Surbhi Jain(Y2390)-B4- surbhij
Tutor - Dr.Harish Karnick
Is it not true that at some time or the other we all have wished for automatic program indentation?
It is extremely difficult to understand even your own code if it is unindented. We can all remember
times when an unindented program has sent our heads spinning as we try to debug it . In our
project, we mean to develop a program which will make programming a more pleasant and less
nerve-racking experience for the user.
We intend to have a project - program which
a) Accepts code in JAVA as input from user
b) Indents it either in the default format or
c) accepts input to build a user-specific format for indentation.
The user would be asked to type in the code and for his specifications
on the indentation style . If no specifications are forthcoming , the
default format would be used.
Sample input 1:
for(int i =0 ; i <100 ; i++){int s =0;
if(num%2 ==0) { s =1; num +=s}
else num+= -1;}
Corresponding Output:
for(int i = 0 ; i < 100 ; i++ )
{
int s = 0;
if ( num % 2 == 0 )
{
s = 1;
num+= s;
}
else
num+= -1;
}
Sample input 2 :
public int compareStr(String s1,String s2){
int p = 1;
while(p==1)
{ if(s1.equals(s2)){p=0;return 1;)
else {int y = 1;
while(y==1)
{ if(StringOps.getReverse(s1).equals(s2)
y = 0; else s2 = s2.substring(1);
for(int p = 1, p <= s1.length() - 1; p++){
p+= 1}
}
}
}
Corresponding output :
public int compareStr( String s1 , String s2 )
{
int p = 1;
while( p ==1)
{
if( s1.equals(s2))
{
p = 0;
return 1;
}
else
{
int y = 1;
while( y == 1 )
{
if ( StringOps.getReverse(s1).equals(s2) )
y = 0;
else
s2 = s2.substring(1);
for(int i = 0 ; i <= s1.length( ) ; i++)
{
p+= 1;
}
}
return p;
}
}
}