### Find the day of your date of birth in java

Here are the steps :
Step 1
• read date of birth as three numbers dd, mm, yyyy (year in 4 digits)
• count the number of days, td,  from 1.1.1900 to dd.mm.yyyy (including both dates)
•  For example, number of days from 1.1.1900 to 2.2.1900 is 33, (that is td=33).
•  divide td by 7 and get the remainder R ( if td=33 then R=5 )

## Eclipse and Java for Total Beginners

This free video tutorial will help get you started writing Java programs using Eclipse version 3.3. No prior experience with Eclipse or Java is assumed. The 16 lessons total about 3 1/4 hours and are each between 9 and 14 minutes long. The lessons guide you through a step-by-step process creating a simple "personal lending library" application. Each lesson is fully narrated.

## What is 2D array(matrix)?

Two-dimensional arrays are defined as "an array of arrays". Since an array type is a first-class Java type, we can have an array of ints, an array of Strings, or an array of Objects. For example, an array of ints will have the type int[]. Similarly we can have int[][], which represents an "array of arrays of  ints". Such an array is said to be a two-dimensional array.

### Creating random numbers and storing in an array in Java

Java version of this program is given below :
```public class Random {
public static int a[];
public int l;
public static int integer(int from, int to){
return (int) Math.round(Math.random()*(to-from))+from;

}
public void array(){
int k=integer(2000,5000);
a=new int[k];
for(int i=0;i<k;i++){
a[i]=integer(2000,5000);
}
}
public int get_key(){
int key=integer(2000,5000);
int index=-1;
for(int j=0;j<a.length;j++){
if(a[j]==key) {
index=j;break;
}
}
return index;

}

public static void main (String args[]){
Random n=new Random();
n.array();
System.out.println("Array length is ="+a.length+"....."                          +"Get the key index ="+n.get_key());
}

}
```

### Data Structures and Algorithms in Java by Michael T. Goodrich pdf download

Chapter Listing The chapters for this course are organized to provide a pedagogical path that starts with the basics of Java programming and object-oriented design, moves to concrete structures like arrays and linked lists, adds foundational techniques like recursion and algorithm analysis, and then presents the fundamental data structures and algorithms, concluding with a discussion of memory management (that is, the architectural underpinnings of data structures). Specifically, the chapters for this book are organized as follows:

## Introduction

YOUR MOTHER probably provided you with constructive toys, like blocks or
Tinkertoys1 or Lego bricks. These toys are educational: they teach us to think
spatially and to build increasingly complex structures. You develop modules
that can be stuck together and rules that guide the building process.
toys. You consider writing programs an artistic process. You have grown
from playing with blocks to writing programs. The same guidelines for building

### Data Structures & Algorithms in Java pdf

What This Book Is About? This book is about data structures and algorithms as used in computer programming.
Data structures are ways in which data is arranged in your computer’s memory
(or stored on disk). Algorithms are the procedures a software program uses to
manipulate the data in these structures.
2 Data Structures & Algorithms in Java, Second Edition
Almost every computer program, even a simple one, uses data structures and algorithms.

## Creating a matrix

In this example  you will learn about array and matrix. An array is the collection of same data type values. If we create a variable of integer type then, the array of int can only store the int values. It can't store other than int data type.
Matrix: A matrix is a collection of data in rows and columns format.
In this program we are going to implement a matrix. To make a program over the two dimensional array,irst of all we have to declare class named as

## Search an element in an array

Find an element from an array using Linear Searching. Linear searching is a good way to find an element from the array. The array can be of any order, it checks whether a certain element (number , string , etc. ) is in a specified array or not. Basically it is used for small arrays. In the given code, we have allowed the user to enter the numbers to be stored into the arrays. If the element is found we can return the index where the element is located in the array. If the element is not found we can return -1.

### Mean - average of array in java

For this, first of all we have to define a class name "ArrayAverage" that has int type array to contain some values .Now we take a double type data that calculates the average of array ( avg = sum / array.length). And finally it will display the result on the command prompt with message by using the System.out.println().

### Maximum element in an array in java

To find the maximum value in an array :

1. Assign the first (or any) array element to the variable that will hold the maximum value
2. Loop through the remaining array elements, starting at the second element (subscript 1). When a larger value is found, that becomes the new maximum.
To make this work with object types (eg String), you will have to change the type declarations of course, but you will also have to change the comparison to use .compareTo(), which must be defined for that object type. The minimum can be found by the same algorithm, simply inverting the test. It's also easy to add a test for the minimum to this loop so that both the maximum and minimum are determined within the same loop. There is one common variation on this -- sometimes it isn't the maximum value that is desired, but the index of the maximum value (eg, so it can be changed).

Java version of the Maximum element problem is given below :
```/**
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package array;

/**
*
* @author ACHCHUTHAN
*/
public class MaxElement {

public static void main(String args[]) {
int[] array = {45, 66, 77, 54, 76, 89, 86, 45, 67, 87};
//assign the first element as maximum
int maximum = array;
int index = -1;
//Find maximum (largest) value in array using loop
for (int i = 1; i < array.length; i++) {
if (array[i] > maximum) {
maximum = array[i];
// new maximum
index = i;
}
}
System.out.println("Maximun element : " + maximum +
"\nIndex of Maximum : " + index);
}
}

```
Output of this program is given bellow :

run:
Maximun element is : 89
Index of Maximum is : 5
BUILD SUCCESSFUL (total time: 1 second)

### Declaring an array in java

An array variable is like other variables -- you must declare it, which means you must declare the type of elements that are in an array. All elements must be the same type. Write the element type name, then "[]", then the name of the array variable. The declaration allocates only enough space for a reference to an array (typically 4 bytes), but doesn't create the actual array object.

### Subtraction of two matrix in java

we are going to calculate the subtraction of two matrix and containing its rows and columns. See below for better understanding to this:
In this program we are going to calculate the  subtraction  of two matrix. To make this program, we need to declare two dimensional array of type integer. Now we need to make a matrix out of it. To make the matrix we will use the for loop.

### Addition of two matrix in java

we are going to calculate the sum of two matrix and containing its rows and columns. See below for better understanding to this:
In this program we are going to calculate the sum of two matrix. To make this program, we need to declare two dimensional array of type integer.

### Graphics 2D OR Java 2D all shapes in java

Java 2D enables the artistic imagination of any programmer to produce high-quality, professional graphics. Java 2D opens the door to numerous possibilities; you can
•  Draw or fill any Shape. Simply call the Graphics2D’s draw or fill methods with the shape as an argument.

### Surface area of the tetrahedron in java

What is a Tetrahedron? Thanks mathematische-basteleien.de

### Compute the area and the circumference of the triangle in java

Source code

```import java.util.*;
import java.lang.Math;
public class Triangle{
double s1,s2,s3;
Triangle(){```

### Calculate age in java using JFrame

Java version of the   Age problem  is given below:
```/**
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package age;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
*
* @author ACHCHUTHAN
*/
public class age extends JFrame implements ActionListener {
```

### Calculate yesterday and tomorrow date in any year in java

Java version of the  this problem is given below :
```/**
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package age;

import java.util.Scanner;

/**
*
* @author ACHCHUTHAN
*/
public class date {
```

## Sorting  matrix

```class Sort_Matrix{
public static void main (String args[]){
int [][] M ={ {1,2,3,4},{2,3,4,5},
{5,6,7,8},{6,7,8,5},{3,7,9,3} };
for(int r=0;r<5;r++){
for(int c=0;c<4;c++){
System.out.print(M[r][c]+"\t ");
}
System.out.println();
}```

### Clock Applet in java

In this example we will see display the time in an applet in the time format like: hours, minutes and then seconds (hh:mm:ss). Here, the ClockApplet is a class name extends from the Applet class and implements to the Runnable interface. There are two threads used in this program. There are three methods have been used in this program to display the current time

Java version of Clock Apple is given bellow :
```import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.util.Date;
import java.util.Random;
```

### Simple Calculator program in java using applet

Java version of Simple Calculator is given bellow :
```package frame;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextField;
```

### Bubble Sorting in Java

Bubble Sorting is an algorithm in which we are comparing first two values and put the larger one at higher index. Then we take next two values compare these values and place larger value at higher index. This process do iteratively until the largest value is not reached at last index. Then start again from zero index up to n-1 index. The algorithm follows the same steps iteratively unlit elements are not sorted

## First Applet

Applet viewer is a command line program to run Java applets. It is included in the SDK. It helps you to test an applet before you run it in a browser. Before going any further, lets see what an applet is?
An applet is a special type of application that's included as a part of an HTML page and can be stored in a web page and run within a web browser. The applet's code gets transferred to the system and then the Java Virtual Machine (JVM) of the browser executes that code and displays the output.. So for running the applet,  the browser should be Java enabled. To create an applet, we need to define a class that inherits the Applet.

### Create Radio Button with Text Field in Java

In this program, you will learn how to set the radio buttons in a group so that only one can be selected at a time.
This program shows five radio buttons with labeled by plain,bold,italic,boldItalic .This program also show a label which contains the text "Font style changes" but when you click on any radio button from a Button Group the text of the selected radio button is shown on the label and a message box will be shown with message holds the selected radio button label. This is done through the generating event for the different-different radio buttons.

### Create Check Box in Java

This section illustrates you how to create a Check Box component in Java Swing.In this section, you can learn simply creating the Check Box in Java Swing. Check Boxes are created in swing by creating the instance of the JCheckBox class using it's constructor which contains the string which has to be shown beside the check box on the frame or window

## Prime number

We will be read how to get prime number between 1 to given number. First of all we have to define a class "primenum ". Java  util package has a input  in which  Scanner input=new Scanner(System.in)  is used for reading the input stream . As in this program we are going to insert certain instruction by creating  Scanner class.
Now applying in this program we use two 'for' loop. For loop will start from 1 to entered number. And another loop will start and divide it from 2 to less than those number. If number is divided by any number that means it is not prime otherwise prime number.

### How to Check Perfect Number in Java

A perfect number is a positive integer where the sum of all its positive divisors, except itself, is equal to the number itself.
For example 6 is a perfect number as 1,2 and 3 are its divisors and the sum of divisors=1+2+3=6. Here we have created a program that will take the number from the user and reports whether it is perfect or not.

### Factorial of a non negative integer in Java

Description of this program :
This Java programming will teach you the methods for writing program to calculate factorial of any given number. First of all define a class "Factorial" under the Java util package. Java util package has a Scanner is used for reading the input . Take an integer variable as fact=1 and insert the message in the System method. Now applying for loop with conditions as integer i=1(intializer), i<=x and i++ as increment operator. So output result will be like fact=fact*i.

### Exponential value for given base in Java

Java version of this program is given bellow :
```/**
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package power;

import java.util.Scanner;

/**
*
* @author ACHCHUTHAN
*/
public class Exponential {

```

### Create JLabel 's Text Using JFrame in Java

Description of this program :
Message dialog box is used to display informative messages to the user. In this section we will use JOptionPane class to display the message Dialog box. Our program display ">>Click<< " button on the window and when user clicks on it program displays Message box with "OK" button and message "You Clicked the Button"

### Create a Simple Frame Window Using JFrame in java

Description of this program :
This program shows you how to create a frame in Java Swing Application. The frame in java works like the main window where your components (controls) are added to develop an application. In the Java Swing, top-level windows are represented by theJFrame class. Java supports the look and feel and decoration for the frame.For creating java standalone application you must provide GUI for a user. The most common way of creating a frame is, using single argument constructor of the JFrame class.

### Addition of time using if condition in Java

Java version of this program is given bellow :
```/**
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package statement;

import java.util.Scanner;

/**
*
* @author ACHCHUTHAN
*/
public class AddTime {
```

### Convert a given decimal number to binary form

Description of program :
This program takes a decimal number from console and it converts it into binary format . Input number is taken as Integer so convert it into an integer data using the while loop method. The Decimal number is divided by 2 and this reminder save in array .Print the binary number in reverse array using for loop

### While Loops Flow Chart in Java

The while statement is used to repeat a block of statements while some condition is true. The condition must become false somewhere in the loop, otherwise it will never terminate.

### Nested for loop to print the pyramids in java

This program to print each of the the following patterns use nested for loop

• Pyramid 1 :
• ```/**
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package loop;

/**
*
* @author ACHCHUTHAN
*/
public class Pyramids {
```