November 09, 2015

FREE ATTENDANCE TRACKING SYSTEM FOR ORGANISATION

November 04, 2015

Sending online compliant using G suite application

Sending Online complaint using G suite application


click here


Full source code


Developed for +consumerfed I T Section , kozhikode Region


http://javabelazy.blogspot.in/

September 19, 2015

Working with microsoft sharepoint

What is the use of share point in an office



configuration files download here





Created an online chat application for Regional office kozhikode . The work was assigned by +bithesh soubhagya . M S Sharepoint was the most suitable application to do this job. Now the regional office staffs can share their work, assign tasks, internal chat etc.


by +belazy

thanks to +Shimjith +Vipin Cp

+Consumerfed IT Division

http://javabelazy.blogspot.in/

August 15, 2015

How to use pivot table in msoffice excel

Working with Pivot table in microsoft office excel

The Pivot Table in Microsoft Office Excel will make you analyze and summarize a large set of data very quickly. Pivot Table is considered to be a powerful feature in Microsoft Office Excel. You can also present data in variety of ways through pivot table. Here i m sharing a MS Excel Pivot table tutorial Or the scope of Pivot table in Excel.



PIVOT TABLE :- HOW TO CONSOLIDATE OR SUMMARIZE DATA



PIVOT TABLE SAMPLE
PIVOT TABLE in EXCEL SAMPLE





Choose the table you need to summarize/analyse.

Pivot Table Data
Creating Pivot table in MS office excel

Create a pivot table for that data : - Go to Insert tab >>  Pivot Table  >>  Create Pivot Table.
A window will be open now, where you have to show the data table. (Please omit the blank column in data table)


Pivot table property window
Creating Pivot Table in M S Office Excel

Choose the data that you want to analyze.

Table / Range : You have to show the data table ( Prefer the data table with header)

Pivot table property window
Creating Pivot Table in MS Office Excel

Choose the field to add in the report : just tick on branch name and amount. A new table with a column will be created having amount under branch name.



Creating Pivot Table in MS Office Excel
Creating Pivot Table in MS Office Excel

If you need to show branch name and sum of amount in separate columns just drag the field amount from row table to sigma function area. ( dragging option in right bottom ). Now the data table will change like below.

Pivot table summarization
Creating Pivot Table in MS Office Excel


These are another types of reports created using the same data using Pivot table in Microsoft Office Excel.

Pivot table analzyse
Creating Pivot Table in M S Office Excel




pivot table report in excel
Creating Pivot Table in MS Office Excel


Author : +belazy

Hope you enjoy the code.


another pivot table example


Thanks to +Shimjith  +Vipin Cp  and +deepajayaprakash payyanakkal  for their supports

@consumerfed  +consumerfed

http://javabelazy.blogspot.in/

July 16, 2015

online sales entering sheet for organisation having multiple branch

Online Sales Entering spreadsheet using google script

As our new software bee bee is down for last few months I T head +bithesh soubhagya assign me a task to create a parallel online sales entering application which helps users to inform their sales to regional office, thus we can debug our bee bee software by informing head office the actual sales. The project was great success, the data was informed head office daily and they correct it on bee bee software.


Created an online sales entering spreadsheet using google script code. The sheet changes daily so that end users can add/enter their daily sales and other details for that day, . The google script in background will automatically send reports daily as email  both in html and pdf formats, The sheet keeps a backup every month in google drive, Once backup is created the sheet will clear the whole data entered in the spreadsheet.




Link to google spreadsheet

Back up


These backup are created using google script code


Algorithm




1. Start

2. Declare variable columns, day, weekends, month, year

3. get todays date from google server (format dd/mm/yyyy)

4. get day from todaysDate

5. check if sunday then skip

6. else hide entire sheet

7. show sheet (day) // say 1,2,3...etc

8. Stop

Source code


function algorithm(){

      var sheetToPdf = SpreadsheetApp.openById("url to sheet ");
      var columnRanges = ["A:A","B:N","O:AA","AB:AN","AO:BA","BB:BN","BO:CA","CB:CN","CO:DA","DB:DN","DO:EA","EB:EN","EO:FA","FB:FN","FO:GA","GB:GN","GO:HA","HB:HN","HO:IA","IB:IN","IO:JA","JB:JN","JO:KA","KB:KN","KO:LA","LB:LN","LO:MA","MB:MN","MO:NA","NB:NN","NO:OA","OB:ON"];

      var todayDate = new Date();
      var day = todayDate.getDate();
      var actualDay = day - 1;
      var saleDay = day;
      var colToHide = day -1;
      var colToHide2 = day -2;
      var colToShow = day;
      var actualMonth = todayDate.getMonth() + 1;
   
      var rangeHide = sheetToPdf.getRange(columnRanges[colToHide]);
      var rangeToShow = sheetToPdf.getRange(columnRanges[colToShow]);
   
   
      sheetToPdf.unhideColumn(rangeToShow);
      sheetToPdf.hideColumn(rangeHide);
   
      if(day > 3){
        var rangeHide2 = sheetToPdf.getRange(columnRanges[colToHide2]);
        sheetToPdf.hideColumn(rangeHide2);
        Logger.log(" Previous date script running issue solved ");
      }
   
      Logger.log("Date : "+todayDate.getDate());
      Logger.log("col to show  : "+colToShow )
      Logger.log("range to show  : "+columnRanges[colToShow] )
   
      Logger.log("Date : "+todayDate.getDate());
      Logger.log("col to hide  : "+colToHide )
      Logger.log("range to hide  : "+columnRanges[colToHide] )
   
      Logger.log(todayDate.getDay());
      Logger.log(todayDate.getDate());
      Logger.log(todayDate.getMonth());
      Logger.log(todayDate.getYear());
   
      //if day is 1
      if(todayDate.getDate()==1){
        //Logger.log(' Today is first day ');
        //rangeToShow = sheetToPdf.getRange(columnRanges[colToShow]);
        sheetToPdf.unhideColumn(sheetToPdf.getRange(columnRanges[0]));
        sheetToPdf.unhideColumn(sheetToPdf.getRange(columnRanges[1]));
        sheetToPdf.hideColumn(sheetToPdf.getRange(columnRanges[28]));//28,29,30,31
        sheetToPdf.hideColumn(sheetToPdf.getRange(columnRanges[29]));
        sheetToPdf.hideColumn(sheetToPdf.getRange(columnRanges[30]));
        sheetToPdf.hideColumn(sheetToPdf.getRange(columnRanges[31]));
      }
   
     // sheetToPdf.copy("SALES_ON_"+todayDate.getYear()+"_"+actualMonth+"_"+saleDay);
      sheetToPdf.rename("SALES_ON_"+todayDate.getYear()+"_"+actualMonth+"_"+saleDay);
}



Email templates










Thanks for accounts manager +deepajayaprakash payyanakkal  for her support in creating this wonderful application for  regional office kozhikode...

Thanks to +Consumerfed IT Division  for assigning this work.



http://javabelazy.blogspot.in/

June 15, 2015

How to consolidate multiple sheets into one sheet in excel

Consolidate in Excel

Description : Excel Consolidate helps you to consolidate your sheets/worksheets into one worksheet.
 Here we are going to consolidate 3 sheets unit1 , unit2 and unit3 to one sheet. the three sheets are shown below. Excel tips and tricks by +belazy .


How to sum up all the data in separates sheet into one



Receipts and Disbursement
Receipts and Disbursement

Receipts and Disbursement of a single unit

Receipts and Disbursement
Receipts and Disbursement




Receipts and Disbursement
Receipts and Disbursement

Now click on the consolidate icon, it will be available in Data tab in excel 2010.



 A window will be open now, choose function as Sum (here we are going to sum up all the sheets)


click on the reference, choose the data table in sheets ancd click on add





check Top row & Left Column.


Consolidate Sheet

Consolidated excel sheet


To view the video tutorial : click here






To Know more about Cash Receipts and Cash Disbursement method in accountancy click here


Where to use : 



Author : +belazy

Thanks to +deepajayaprakash payyanakkal  for her support

+Consumerfed IT Division

Similar posts


create a commodity sales graph

multiple user sharing a  excel sheet




http://javabelazy.blogspot.in/

May 27, 2015

Employee card html template


Employee card Html template




<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="CSS/employee.css" rel="stylesheet">
<title> New Horison</title>
</head>
<body>

<div class="oms-header">
<ul>
<li><a href="http://javabelazy.blogspot.in">  Pluto </a></li>
<li><a href="test.html"> Neptune </a></li>
<li><a href="test.html"> mercury </a></li>
<li><a href="test.html">  Pluto </a></li>
<li><a href="test.html"> Neptune </a></li>
<li><a href="test.html"> mercury </a></li>

</ul>
</div>




<div id="map">
<div id = "company_by_category_list">
<div id="content">
<table width="100%" cellspacing="0" cellpadding="0" bgcolor="white" style="font-family:arial,'sans-serif';line-height:17px;font-size:12px;" id="listing_category_content">
    <tbody>
    <!--
    <tr><td colspan="2" id="td_container"></td></tr>
    -->
                    <tr>
            <td colspan="2">
            <!--  employee card loop -->
<div style="background-color: #FFF8DC; width:689px; position:relative;" class="employee_business_card">
         <div style="">
             <table width="98%" cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                         <tr>
                            <td class="start_no"></td>
                            <td valign="top" class="cl_thumbnails" rowspan="4" style="width: 150px;">
                                    <a href="employeeDetails.html"  class="anchor">
                                        <div style="position:absolute;">                                          
                                            <img width="128" height="102" border="0" alt="deepapayyanakkal" style="border: 1px solid white; left: 6px; position: relative; z-index: 2; top: 11px; display: inline-block; width: 128px; height: 102px;" src="IMAGES/EMPLOYEE/Accounts_Manager/Deepa_Jayaprakash.jpg">
                                        </div>
                                    </a>
                             </td>
                             <td valign="top" style="padding-top: 9px; position:relative; height:21px;">
                                    <div class="TextBold ver_14 company_name_premium">
                                        <h3 class="fleft">
                                            <a itemprop="name" href="employeeDetails.html" onclick="show_detail('210000','4940','18049','company_minisite',true,{'show_navigation':true,'no_urut':0,'listing':true}); return false;" class="listing_company_name"> Deepak Thiruvananthapuram</a>
                                        </h3>
                                     </div>
                             </td>
                        </tr>
                        <tr valign="top">
                                <td rowspan="5">&nbsp;</td>
                                <td height="100%">
                                    <table width="100%" cellspacing="0" cellpadding="0" border="0" valign="top">
                                        <tbody>
                                        <tr> <td valign="top"></td></tr>
                                        <tr>
                                            <td>
                                                <table width="100%" cellspacing="0" cellpadding="0" border="0">
                                                <tbody>
                                                <tr>
                                                       <td valign="top" itemprop="description" style="padding:3px 20px 4px 0;" colspan="3" class="ver_13 Link22" id="listing_tr_text_ads">
                                                            <div class=""><b> Free lance worker </b>
<br> The ESA and NASA is planning to launch Lisa parth finder
</div>
                                                        </td>
                                                 </tr>
                                                 <tr itemtype="javabelazy.blogspot.in/" itemscope="" itemprop="address" style="color:#666666;" id="employee_address">
<td valign="top" nowrap="" style="padding-right: 3px;">Address</td><td width="2%" valign="top">:</td>
<!-- <td valign="top" class="Link21">Workshop, <a href="javabelazy.blogspot.in/">Trivandrum</a>, kerala<span class="displayhide" itemprop="streetAddress">Andrapradesh,Telugana</span><span class="displayhide" itemprop="addressLocality">India</span><span class="displayhide" itemprop="addressRegion">singapore</span>, <span itemprop="postalCode">808025</span></td> -->
<td valign="top" class="Link21"> National Aeronotic space resarch centre, India , pin 828180</td>
</tr>                                                                                                      
<tr style="color:#666666;" id="listing_tr_category">
                                                        <td width="10%" valign="top" nowrap="" style="padding-right: 3px;" class="TextGrey Link21">Works</td><td width="2%" valign="top" class="TextGrey Link21">:</td>
<td class="TextGrey Link21">
                                                        <div>
                                                <a itemprop="description" href="taskDescription.html">Testing piolet</a>,
                                                <a itemprop="description" href="taskDescription.html">All testing</a>,
                                                <a itemprop="description" href="taskDescription.html">Quality assurance</a>,
                                                <a itemprop="description" href="taskDescription.html">System Administration</a>,
                                                <a itemprop="description" href="pricecontrollingofficer.html">Software Reports</a>,
                                                <a itemprop="description" href="accountsmanager.html">Assign Calls</a>                                                                                                                                            
                                                         </div>
                                                         </td>
                                                  </tr>
<tr class="tr_contact_listing">
                                                            <td valign="top" nowrap="" style="padding-right: 3px;">Telphone</td><td width="2%">:</td>
                                                      <td class="Link18">
                                                                <img  src="IMAGES/tel-icon.png">
                                                                <span itemprop="telephone"  style="float: left; margin-top: 1px; font-weight: bold; color: rgb(89, 114, 168); cursor: pointer; text-decoration: none;" class="telphone_text_number">8281808025</span>
                                                            </td>
                                                  </tr>
                                                 <tr class="tr_contact_listing">
                  <td width="8%" valign="top" nowrap="" style="padding-right: 3px;">Qualification</td><td width="2%">:</td>
                                                <td itemprop="url" class="Link18 TextBold">
                                                <a  target="_blank" rel="nofollow" href="http://javabelazy.blogspot.in/" class="web_link_comp">Master in Business Administration </a>
                                                             </td>
                                                  </tr>
                                                  <tr class="tr_contact_listing">
                                                            <td valign="top" nowrap="" style="padding-right: 3px;">Blood Group</td><td width="2%">:</td>
                                                      <td class="Link18">
                                                                <span itemprop="telephone" onmouseout="this.style.textDecoration = 'none'" onmouseover="this.style.textDecoration = 'underline'" style="float: left; margin-top: 1px; font-weight: bold; color: rgb(89, 114, 168); cursor: pointer; text-decoration: none;" class="telphone_text_number"> B+ve</span>
                                                            </td>
                                                  </tr>
                                             </tbody>
                                         
                                        </table>
                                       </td>
                                    </tr>
                             </tbody></table>
                            </td>
                            </tr>
                             <tr class="button_container_tr">
                                <td valign="top" colspan="2" style="padding: 5px 0;">
                                    <table cellspacing="0" cellpadding="0" border="0">
                                        <tbody>
                                        <tr>
                                            <td class="TextBold">
<div onclick="http://javabelazy.blogspot.in/" class="bll_link save_btn" id="8281"><div class="star_grey"></div>Email </div>
                                        </td>
                                        </tr>
                                    </tbody></table>
                                </td>
                            </tr>
                                                    </tbody></table>
                    </div>
                </div>
            </td>
        </tr>
 
</tbody>
</table>
</div>
</div>
</div>


<div id="footer">
http://javabelazy.blogspot.in/
</div>

</body>
</html>


Cascading Style Sheet ( Employee.css)





/*
header style

*/

.oms-header ul {
    float: left;
    width: 100%;
    padding: 0;
    margin: 0;
    list-style-type: none;
}

.oms-header a {
    float: left;
    width: 6em;
    text-decoration: none;
    color: white;
    background-color: #808080;
    padding: 0.2em 0.6em;
    border-right: 1px solid white;
}

.oms-header a:hover {
    background-color: #A8A8A8;
}

.oms-header li {
    display: inline;
}

.oms-header  {
    width: 100%;
}

/*
header style ends

*/



                                                              ----------

#map {
    margin-top: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0;
    width: 721px;
}


#company_by_category_list {
    border-left: 1px solid #ebebeb;
    margin-top: 10px;
    padding-bottom: 10px;
    padding-left: 19px;
}


element.style {
    background-color: #ffffff;
    position: relative;
    width: 689px;
}
.employee_business_card {
    border-color: blue;
    border-style: solid;
    border-width: 1px;
    margin-bottom: 10px;
    padding: 5px;
}

#content {
    clear: both;
    display: block;
}




http://javabelazy.blogspot.in/

May 22, 2015

To create a shared excel sheet for multiple user access at real time


How to share an excel that helps multiple user to edit same time

I need an excel sheet , where multiple users ( class 4 employees ) can post mark list of students to an excel in my office, where higher officials need to check the result entered is correct or not whereas other staffs need to download the result before publishing. All the works has to done simultaneously. here is a solution for such issues. Over usage of styles will hang the file. If two users edit the same cell, the excel asks who's data to be saved while saving the document. If two users try to save the shared excel at same time, the file will be locked, the only thing you can do at this situation is to wait until the other person saves Or wait for some times the issue will be solved.



Share workbook Option is available in Review Tab.

Click on Share

Excel Share
Sharing in Excel


Check the option Allow changes by more than one user at the same time.

Once you shared the excel sheet and multiple user starts working on it, Here you can see the users who are working on the excel workspace.



Multiple user access excel
Allow sharing mode in excel


Click ok to share the excel


Excel Share
Share Excel Workspace


Track changes

To track changes made by all users use the following steps, go to track chages option in review tab, check the option when, who, where, List changes on a new sheet

shared excel track changes
Track chages in an excel


Posted by +belazy


http://javabelazy.blogspot.in/

April 21, 2015

To call spring controller from ajax jquery in java spring

Ajax Jquery call to java spring controller


Description : The program will helps you to call java spring controller  from ajax jquery. To know spring configuration please refer this link. The link shows a  Hello world Model View Controller java spring example.

index.jsp


jquery api needed

<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript" src="jqueryApps.js"></script>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>

These jquery api should be paste in your WEB-INF folder.


jqueryApps.js


function callJavaSpringController(){
var jqueryData = 'java spring mvc';
alert(senderEmail);

 $.ajax({
       type: "GET",
       url: "callcontroller.html",
       data: { message : jqueryData }
     }).done(function( msg ) {
       alert( "Data Saved: " + msg );
     });
}


JavaSpringSampleController.java


/**
JavaSpringSampleController  class
*/
package net.cfed.oms.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.cfed.oms.model.SendMailModel;
import net.cfed.oms.service.EmployeeService;
import net.cfed.oms.serviceImpl.EmployeeServiceImpl;

import org.apache.catalina.connector.Request;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author free source codes
 *
 */
@Controller
public class JavaSpringSampleController {

@RequestMapping("/callcontroller")
public ModelAndView helloWorld(HttpServletRequest request, HttpServletResponse response) {

String message = "Welcome  to";
                message = message + request.getParameter("message");
System.out.println(message);
return new ModelAndView("index", "message", message);
}
}


Here is a sample for ajax jquery call to servlet , click on the link

http://javabelazy.blogspot.in/

April 14, 2015

Automatically typing notepad in java


A Notepad that works automatically in java


/**
 * Funny notepad automatically wishing birthday
 */
package com.blogspot.javabelazy.funny;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.lang.reflect.Field;

/**
 * @author +Vipin Cp
 *
 */
public class HappyBirthdayMessage {

/**
* @param tokyo
*/
public static void main(String[] tokyo) {
// TODO Auto-generated method stub
HappyBirthdayMessage message = new HappyBirthdayMessage();
String yourMessage = "Happy Birthday Jerin V George";
Runtime runtime = Runtime.getRuntime();
try {
                       Thread.sleep(5000);
runtime.exec("notepad");
Thread.sleep(3000);
message.createMessage(yourMessage);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

private void createMessage(String message) {
// TODO Auto-generated method stub
try {
Robot robot = new Robot();
int length = message.length();
for(int i=0;i<length;i++){
char letter = message.charAt(i);
String keyVal = Character.toString(letter);
String variableName;
if(keyVal.equals(" ")){
variableName ="VK_SPACE";
}else{
variableName = "VK_"+keyVal.toUpperCase();
}


Class clazz = KeyEvent.class;
   Field field = clazz.getField(variableName);
   int keyCode = field.getInt(null);
   robot.keyPress(KeyEvent.VK_SHIFT);
   robot.keyPress(keyCode);
   robot.delay(1000);
}

} catch (AWTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}

Java tips and trick by +belazy

http://javabelazy.blogspot.in/

April 13, 2015

Binary Search Algorithm implementation in java

Binary Search Algorithm in Java source code


Description

Find the position of specific input value within a sorted array (either descending/ascending).
The algorithm compares the key value with the middle value of array, if the key matches it will return the value or other wise returns -1 value.

Time complexity for binary
Worst : O (log n)
Average : O (log n)


Binary Search Algorithm Gif image
Binary Search Algorithm Computation

int []values = {1,2,5,6,12,25,26,27,30}; // sorted array


/**
 * Binary Search algorithm or Half interval search algorithm implementation
 * Find the position of a specific value (key) from/within a sorted array
 */

package com.blogspot.javabelazy.logics;

/**
 * @author javabelazy
 *
 */
public class BinarySearch {

private static int attempt = 0;

private int findIndex(int[] values, int target) {
return binarySearch(values,target,0,values.length-1);
}

private int binarySearch(int[] values, int target, int start, int end) {
attempt = attempt +1;
if(start > end){
return -1;
}

int middle = (int) Math.floor((start+end)/2);
int value = values[middle];

if (value > target) { return binarySearch(values, target, start, middle-1); }
if (value < target) { return binarySearch(values, target, middle+1, end); }

return middle;
}

/**
* @param binsearchalgo string
*/
public static void main(String[] binsearchalgo) {
int []values = {1,2,5,6,12,25,26,27,30}; // sorted array
int target = 27; // value to be find (the key in binary search algorithm)
BinarySearch binarySearch = new BinarySearch();
int position = binarySearch.findIndex(values,target);
System.out.println(" Size of the array to search : "+values.length);
System.out.println(" Value to be found : "+target);
System.out.println(" Position of the value found : "+position);
System.out.println(" Attempt made in finding value : "+attempt);
System.out.println(" www.javabelazy.blogspot.in ");

}
}

Output



BINARY SEARCH ALGORITHM IMPLEMENTATION IN JAVA
binary search algorithm implementation in java


Author : +belazy


Java source code for binary search algorithm



http://javabelazy.blogspot.in/

April 08, 2015

Fibonacci series implementation in java

How to find fibonacci series of a given number source code

package com.blogspot.javabelazy.programs;
import java.util.Scanner;
/*
 * Fibinocci number series implementaion in java
 * Series : 0, 1, 1, 2, 3, 5, 8, 13
 */


/**
 * @author vipin
 * Fibinocci Series Java full source code download
 */
public class FibinocciSeries {

/**
* @param args
*/
public static void main(String[] bestJavaBlog) {

System.out.println(" Enter the nth number to find the fibinocci value ");
Scanner sc = new Scanner(System.in);
int input = sc.nextInt();  // user input
//int input = 99;
int previousNumber = 0;
int number = 1;
int nextNumber = 0;
System.out.println("\n Fibinocci series upto "+input +"th number ");
for(int i=0;i<input;i++){
if(i==0){
//initialize
System.out.print(" "+previousNumber);

}else if(i==1){
System.out.print(", "+number);
}
else{
nextNumber = previousNumber + number;
System.out.print(", "+nextNumber);
previousNumber = number;
number = nextNumber;
}
}
System.out.println("\n Created by http://www.javabelazy.blogspot.in ");
}
}

Output

Fibonacci series source code
Fibonacci Series implementation in java



Fibonacci Series Algorithm


1. Start
2. Decalare variables incr, first, second, value
3. Initialize the variables first  as 0, value  as 0 and second as 1
4. Enter the nth term of the Fibonacci to be outputted
5. Print first two terms
6. Then loop the below code upto the nth term
    value = first + second
    first = second
    second = value
    increment variable incr each time by 1
7. Print the value in the variable value
8. Stop


About Fibonacci Sequence

The Fibonacci Series is a series of number where the next number is found by adding up last two number in the series.

Series : 0,1,1,2,3,5,8,13,21,34 and so on

Fibonacci Number, their ration is very close to Golden ration "phi" which is equal to 1.618.

Real world example : Fibonacci considers the growth of shell of snail, Petals of flower




Author : +ITSECTION CIVILSUPPLIES 

http://javabelazy.blogspot.in/

March 02, 2015

How to find factorial of a number using recursion in java


How to Find Factorial of a number using recursion in java


/**
 * How to find factorial of a number using recursion, while loop and for loop
 */

/**
 * @author Samsung Galaxy
 *
 */
public class Factorial {

private int usingRecursion(int num) {
// TODO Auto-generated method stub
int result =1;
if(num==1){
return 1;
}
result = usingRecursion(num-1) * num;
return result;
}

private int usingWhileLoop(int num) {
// TODO Auto-generated method stub
int result =1;
while(num>1){
result = result * num;
num = num -1;
}

return result;
}


private int usingForLoop(int num) {
int result =1;
for(int value=2;value<=num;value++){
result = result * value;
}
return result;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int inputValue =4;
Factorial factorial = new Factorial();
int number = factorial.usingRecursion(inputValue);
int numb = factorial.usingWhileLoop(inputValue);
int numbr = factorial.usingForLoop(inputValue);
System.out.println("Factorial using recursion method is : "+number +", using while loop is : "+numb+" and using for loop is : "+numbr);

}

}

Output



Source code java Factorial
Factorial in Java


About Fibonacci Sequence

The Fibonacci Series is a series of number where the next number is found by adding up last two number in the series.

Series : 0,1,1,2,3,5,8,13,21,34 and so on

Fibonacci Number, their ration is very close to Golden ration "phi" which is equal to 1.618.

Real world example : Fibonacci considers the growth of shell of snail


http://javabelazy.blogspot.in/

Facebook comments