1 Replies - 552 Views - Last Post: 09 October 2012 - 08:37 PM Rate Topic: -----

#1 Portista90  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 09-October 12

Filling a 2d array with a,b,c problem

Posted 09 October 2012 - 07:34 PM

Hey peeps! I'm new to the site and still pretty new to programming(just starting to understand more and more), but I need your help! I have this assignment for class and I cant seem to figure it out. If someone could help me that would be awesome! Thanks in advance, here is the assignment:

Palidrome Quiz



Generate (write the code) and save in an array Palidrome[250][5] all the 5 letter words using {a, b, c}

Write the code and show the execution for:

a.) Count the number of palindromes in this set.


b.) Print out all the palindromes where a letter appears more than twice.

Examples a a b a a ; b b b b b; c a c a c; a b b b a etc.



c.) Print out all the palindromes where a letter appears no more than twice.

Examples a b c b a; a c b c a etc.

Here is what I have so far(its not much and I'm not even sure if its right):
public class palidrome {
public static void main(String args[]){

int row = 250;
int col = 5;
char [][] random= new char[250][5];
for(int i=0; i<row; i++)
	for(int j=0; j<col; j++)
		random[i][j]=
		

//String s = "atjda";


//if(s.charAt(0) == s.charAt(4)&&s.charAt(1) == s.charAt(3)){
//System.out.println("This is a palindrome");
//}else{
//System.out.println("This is not a palindrome");
//for(int counter = 0; counter >=)
//if(s.charAt(0) == s.charAt(2)|| s.charAt(1)==s.charAt(2)||s.charAt(0)==s.charAt(1)){
//System.out.println("1 :" +s);
//}else{
//System.out.println("2 :" +s); 

}
}
}


This post has been edited by baavgai: 10 October 2012 - 04:17 AM
Reason for edit:: tagged


Is This A Good Question/Topic? 0
  • +

Replies To: Filling a 2d array with a,b,c problem

#2 Kinaces  Icon User is offline

  • D.I.C Head

Reputation: 78
  • View blog
  • Posts: 230
  • Joined: 04-October 12

Re: Filling a 2d array with a,b,c problem

Posted 09 October 2012 - 08:37 PM

Please use code tags, and point out where you need help/what you aren't sure is working..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1