Pattern-6

Description:          This program prints the following pattern:                                      1                                     121                                   12321                                 1234321                               123454321 Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is ...

Pattern-5

Description:          This program prints the following pattern: * ** *** **** 1234    *  ** ******* Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is generated for ...

Pattern-4

Description:          This program prints the following pattern:                                      0                                      12                                      345                                      6789                                      01234 Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is generated for n lines ...

Pattern-3

Description:          This program prints the following pattern:                                      0                                      10                                      101                                      0101                                      01010  Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is generated for n lines ...

Pattern-2

Description:          This program prints the following pattern:                                      1                                      222                                      33333                                      4444444 Primary Inputs:    Generates a single digit random number as the number of lines Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern ...

Pattern-1

Description:          This program prints the following pattern:                                      1                                      22                                      333                                      4444  Primary Inputs:    Generates a single digit random number Primary Output:    The pattern specified above Platform Used:      JDK 1.6 with JCreator   Java //Primary Input : Generates a single digit number (n) representing the number of lines /* Primary Output: The following pattern is generated for n lines ...

Palindrome test

Description:          The following program takes an integer as input and checks to see if the number is a palindrome, i.e. the number reads the same forward and backward (eg. 12321) Primary Inputs:    an Integer Primary Output:    Determine if the input number is a palindrome or not. Platform Used:      JDK 1.6 with Notepad.   Java import java.io.*; class Palindrome { public static void ...

MatchStick Game 3

Description:     Program for matchstick game being played between the computer and the user.It ensures that computer always wins. Rules for the games are as follows:            1. Number of matchsticks are entered by user.            2. The computer asks the player to pick 1,2 or 3 matchsticks. ...

Log4j Example

Description :  Log4j Example with BasicConfigurator and PropertyConfigurator  Java /*>>>>>>>>>>>>>>>>Program1 with BasicConfigurator<<<<<<*/ /*>>>>>>>>>>>>>>>>SampleLog4j.java<<<<<<<<<<<<<<<<<<*/ package com.example; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Level; import org.apache.log4j.Logger; public class SampleLog4j { static final Logger logger = Logger.getLogger(SampleLog4j.class); public static void main(String... args) { BasicConfigurator.configure(); Logger.getRootLogger().setLevel(Level.DEBUG); System.out.println(logger.isDebugEnabled()); logger.debug("Sample debug message"); logger.info("Sample info message"); logger.warn("Sample warn message"); logger.error("Sample error message"); logger.fatal("Sample fatal message"); } ...

LinkedList in Java

Linked List implementation in Java… ====================Node.java===================== Java public class Node { int key; Node link; public void setKey(int key) { this.key = key; } public int getKey() { return this.key; } public void setLink(Node node) { this.link = node; } public Node getLink() { return this.link; } public static Node createNode(int key, Node link) { ...