first commit

This commit is contained in:
Jose Caban
2025-06-07 01:59:34 -04:00
commit 388ac241f0
3558 changed files with 9116289 additions and 0 deletions

63
CS1322/t2/Test2.java Normal file
View File

@@ -0,0 +1,63 @@
public class Test2 extends Test1{
public String name;
public Test2(){
this("bob");
}
public Test2(String name){
System.out.println("Test2(name)");
this.name = name;
}
public String reverse(String s){
String bwd;
if(s.length() != 1){
bwd = reverse(s.substring(1)) + s.substring(0,1);
}
else {
bwd = s;
}
return bwd;
}
public boolean isPalindrome(String s){
String bwd = reverse(s);
if(s.equals(bwd)){
return true;
}
return false;
}
public void printTwoSquares(int a, int b){
int iA=0,iB=0,rA=0,rB=0;
char print = '#';
while(rA<a || rB<b){
if(rA >= a){
print = ' ';
}
for(iA=0;iA<a;iA++){
System.out.print(print);
}
System.out.print(" ");
for(iB=0;iB<b;iB++){
System.out.print("#");
}
System.out.println();
rA++;
rB++;
}
}
public static void main(String args[]){
Test2 bob = new Test2();
System.out.println(bob.reverse("Trent Reznor"));
/*String s = bob.reverse("Tom the Eal");
System.out.println(s);
System.out.println(bob.isPalindrome("poop"));
System.out.println(bob.isPalindrome("vegetta"));
bob.printTwoSquares(5,3);*/
}
}