Posts

Easy Sorting in Java

Image
Are you confused of using techniques such as Bubble sort or Selection sort in order to sort the elements in an array? I don't say that these sort techniques are so complex, rather I would say that there are some alternatives for sorting the array using the inbuilt methods in java. There is a class called Arrays in the util package of java: java.util.Arrays; In this class there is an method called Arrays.sort() ; This is used to sort the elements of an array in an ascending order. Don't forget to note that the class name Array s is in plural form. Pass the name of the array in the parameter of the method and you will find that the elements in the array will be sorted and stored in the same array. You can also pass the from_Index and to_Index along with the array name in the parameter. The parameter can be of any array type such as int[], char[], byte[], etc. Take a look at this program: - /**Importing the required class*/ import java.util.Arrays; /**Cl

Magic Square in JAVA

/**  * Magic Square  * version.... 1.0.0  * Copyright: ECP - II  * author@ Ishwar ECP - II  * Asst : ECP - II  * Date: 10:06 AM -- 30/11/2017  *   *  Description:  *  This program is a first level of Artificial Intelligence;  *  When you give an odd input you will be provided with a square [n x n] in which all the rows, columns and diagonals,   *  when summed up, gives the same result;   *  Enjoy the Program ;)  */ import java.util.Scanner; //Defining class MagicSquare public class MagicSquare { int n ; //Method to get input from the User void input(){ //Creating object for class Scanner @SuppressWarnings ( "resource" ) Scanner sc = new Scanner(System. in ); System. out .println( "*******************************************************************" ); System. out .println( "*****************************MAGIC SQUARE**************************" ); System. out .println( "********

java PROJECT for icse students : CINEMASTER

Hi, here is a program for icse 10th student's projects. /**  * This is a class as a website that is used to book your tickets for your favorite new cinemas in popular theaters...  * You can also order you food in your theaters to fully enjoy your cinema...  * Follow the instruction during the running and you can book your cinema ticket Successfully...  * @author (S.Ishwarkumar_10th std.)  * @version (The first version of www.cinemaster.com <1.0.0> . You can find many options of booking your ticket.)  */ import java.io.*; import java.util.*; class C_I_N_E_M_A_S_T_E_R {     public static void C_I_N_E_M_A_S_T_E_R()throws IOException     {         String ex;        do{        Date date=new Date();         Calendar ca=Calendar.getInstance();         BufferedReader b=new BufferedReader(new InputStreamReader(System.in));         String th="";int r=0,fd,tot_fd=0,tot_d,bvrg,tot_bvrg,snck,tot_snck,fl=0,q,w=0;int d=0,m=0,y=0;         int rem=0;int s=0;int cr=0;float ti=0;