code, JAVA Programming

pls telme source code for Padovan String
Posted Date: 9/1/2012 2:34:49 AM | Location : United States

package test.padovanstring;

public class PadovanString {
public int stringOccurrences(int n, String str){

if(n >= 40)
return -1;
return -1;
String res=pad(n);
return(res.length() - res.replaceAll(str,"").length())/(str.length());
public String pad(int n){
if(n == 0) return "X";
if(n == 1) return "Y";
if(n == 2) return "Z";
else return pad(n-2) + pad(n-3);

public static void main(String []args)
PadovanString p = new PadovanString();
Posted by gourav | Posted Date: 9/7/2012 11:48:55 AM

Related Discussions:- code, Assignment Help, Ask Question on code, Get Answer, Expert's Help, code Discussions

Write discussion on code
Your posts are moderated
Related Questions

Explain The package Each package describes a number of classes, interfaces, exceptions, and errors. For instance, the package contains these, classes, interfa

Modify your UserProfile class to meet the following requirements: It must include a field called wall to store an ArrayList of wall posting objects. It must also provide

If I have a boolean array that contains 30 elements (boolean[] fish), how do I go about isolating every 10 elements to use for something specific? Say there are 30 types of fish s

Develop E-Commerce Website I need an E-Commerce website for my furniture shop which requires to an online store to buy products online. So, Skills required: HTML, Java, Gr

Design A Word document/ report containing program design documentation, including UML diagrams (Use case, class and sequence) and written descriptions of each class or module

Why hub is used in networks? HUB: Hub is networking component that can be used to connect the networks and it could also be used to extend the size of networks. In a simple way

Individual Assignment Rework Asteroids to have a different gameplay In the previous assignments, we have developed an Asteroids game. In this assignment, we are going to u

What type of information can be stored in a database? In a database we can store several types of informations like: • Numbers, Booleans, text • Sounds • Images • Video

Data integrity helps to make sure if something is communicate and not tampered with in the mean while when transmission take place. Checksums: Simply inserts the bytes withi