Tuesday, 20 September 2016

Android Based Multi-Shop Fast Food Order System

This Android based project will help users to order their favorite fast food from their favorite food chain in a single application and also can compare the price of same products of different companies.
This System can also be called as `Price Comparing System`, not Limited to Fast Food, `Anything Order System` and so on...

Switch Statement Example in Java Swing Package

import javax.swing.JOptionPane;
    class Switch{
        public static void main(String[]args) throws Exception{
            String input = JOptionPane.showInputDialog("Enter");
            int percentage = Integer.parseInt(input);
        switch(percentage){
            case 90:
                JOptionPane.showMessageDialog(null, "A+ Grade");
                    break;
            case 80:
                JOptionPane.showMessageDialog(null, "A Grade");
                    break;
            case 70:
                JOptionPane.showMessageDialog(null, "B Grade");
                    break;
            case 60:
                JOptionPane.showMessageDialog(null, "C Grade");
                    break;
            case 50:
                JOptionPane.showMessageDialog(null, "D Grade");
                    break;
            case 40:
                JOptionPane.showMessageDialog(null, "IMPROVED");
                    break;
            default:
                JOptionPane.showMessageDialog(null, "Fail");
               
        }
        }
    }

Marksheet In Else-If Statement Java Program Swing Package

import javax.swing.JOptionPane;
    class IfElseMarksheet{
        public static void main(String[]args) throws Exception{
            String a = JOptionPane.showInputDialog("Enter Java Marks");
            int java = Integer.parseInt(a);
            String b = JOptionPane.showInputDialog("Enter PHP Marks");
            int php = Integer.parseInt(b);
            String c = JOptionPane.showInputDialog("Enter VB Marks");
            int vb = Integer.parseInt(c);
            String d = JOptionPane.showInputDialog("Enter C++ Marks");
            int cpp = Integer.parseInt(d);
            String e = JOptionPane.showInputDialog("Enter Ruby Marks");
            int ruby = Integer.parseInt(e);
           
            int total = 500;
            int obtained = java + php + cpp + vb + ruby;
            int percentage = obtained * 100 / total;
           
            if(java >39){
                if(php > 39)
                if(vb >  39)
                if(cpp > 39)
                if(ruby > 39)
                if(percentage < 100)
                if(percentage >= 80)
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got A+ Grade");
}
       
           else if(java >39){
                if(php > 39)
                if(vb >  39)
                if(cpp > 39)
                if(ruby > 39)
                if(percentage <  80)
                if(percentage >= 70)
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
             
                              "\n You Are Pass" + "\n You Got A Grade");
}
           
           else if(java >39){
                if(php > 39)
                if(vb >  39)
                if(cpp > 39)
                if(ruby > 39)
                if(percentage <  70)
                if(percentage >= 60)              
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got B Grade");
}
           
           else if(java >39){
                if(php > 39)
                if(vb >  39)
                if(cpp > 39)
                if(ruby > 39)
                if(percentage <  60)
                if(percentage >= 50)              
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got C Grade");
}
           
           else if(java >39){
                if(php > 39)
                if(vb >  39)
                if(cpp > 39)
                if(ruby > 39)
                if(percentage <  50)
                if(percentage >= 40)              
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got D Grade");
}

            else{
                JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Fail");
}

        }
    }

Wednesday, 7 September 2016

Operator Selector Calculator Java Program

Operator Based Calculator Using Swing Package



import javax.swing.JOptionPane;
    class OperatorCalc{
        public static void main(String[]args){
            String operator = JOptionPane.showInputDialog("Enter any Operator" );
            String op = operator;
           
            String v1 = JOptionPane.showInputDialog("Enter First Value" );
            int value1 = Integer.parseInt(v1);
           
            String v2 = JOptionPane.showInputDialog("Enter Second Value" );
            int value2 = Integer.parseInt(v2);

   
    if (!(op == "+" || op == "-" || op == "*" || op == "/" || op == "%" ))
        JOptionPane.showMessageDialog(null, " Enter a valid Operator");
           
           
    if( op == "+" )
        JOptionPane.showMessageDialog(null, " Addition is " + (value1 + value2) );
           
    if( op == "-" )
        JOptionPane.showMessageDialog(null, " Subtraction " + (value1 - value2) );
           
    if( op == "*" )
        JOptionPane.showMessageDialog(null, " Multiplication is " + (value1 * value2) );
           
    if( op == "/" )
        JOptionPane.showMessageDialog(null, " Division is " + (value1 / value2) );
           
    if( op == "%" )
        JOptionPane.showMessageDialog(null, " Reminder is " + (value1 % value2) );
           
        }
    }

Menu Based Calculator Java Program

GUI Based Menu Calculator Using Swing Package



import javax.swing.JOptionPane;
    class MenuCalc{
        public static void main(String[]args) throws Exception{
            String select = JOptionPane.showInputDialog( "Enter Number 1-5" +
                                                        "\n 1 == Addition " +
                                                        "\n 2 == Subtraction " +
                                                        "\n 3 == Multiplication " +
                                                        "\n 4 == Division " +
                                                       "\n 5 == Reminder ");
            int Menu = Integer.parseInt(select);

            String v1 = JOptionPane.showInputDialog( "Enter First Value ");
            int value1 = Integer.parseInt(v1);
           
            String v2 = JOptionPane.showInputDialog( "Enter Second Value ");
            int value2 = Integer.parseInt(v2);
           
            if(Menu == 1)
            JOptionPane.showMessageDialog(null, value1 + value2);
       
            if(Menu == 2)
            JOptionPane.showMessageDialog(null, value1 - value2);

            if(Menu == 3)
            JOptionPane.showMessageDialog(null, value1 * value2);
       
            if(Menu == 4)
            JOptionPane.showMessageDialog(null, value1 / value2);

            if(Menu == 5)
            JOptionPane.showMessageDialog(null, value1 % value2);
       
            if(!( Menu == 1 || Menu == 2 || Menu == 3 || Menu == 4 || Menu == 5))
            JOptionPane.showMessageDialog(null, " Enter Valid Menu ");
       
        }
    }

Billing System Java Program

Java Program Billing System According to Units Using `util` Package


import java.util.Scanner;
    class HESCOBill{
        public static void main(String[]args) throws Exception{
            Scanner s = new Scanner(System.in);
            System.out.print(" Enter Units ");
                String bill = s.nextLine();
                int units = Integer.parseInt(bill);
            if( units >= 1 && units <=100 )
                System.out.print("Your bill is " + units * 2 );
            if( units > 100 && units <=200 )
                System.out.print("Your bill is " + units * 4 );
            if( units > 200 && units <= 300 )
                System.out.print("Your bill is " + units * 6 );
            if( units > 300 && units <= 400 )
                System.out.print("Your bill is " + units * 8 );
            if( units > 400 )
                System.out.print("Your bill is " + units * 10 );
        }
    }

Thursday, 1 September 2016

Java Program (Age Comparison)

THREE AGE COMPARISON IN SWING PACKAGE


import javax.swing.JOptionPane;
    class Three_Age{
        public static void main(String[]args) throws Exception{
            String text = JOptionPane.showInputDialog("Enter First Age");
            int Age1 = Integer.parseInt(text);

            String text2 = JOptionPane.showInputDialog("Enter First Age");
            int Age2 = Integer.parseInt(text2);

            String text3 = JOptionPane.showInputDialog("Enter First Age");
            int Age3 = Integer.parseInt(text3);
    
        if( Age1 > Age2 && Age1 > Age3 )
            JOptionPane.showMessageDialog( null, Age1 + " is Greater" );
        if( Age2 > Age1 && Age2 > Age3 )
            JOptionPane.showMessageDialog( null, Age2 + " is Greater" );
        if( Age3 > Age1 && Age3 > Age2 )
            JOptionPane.showMessageDialog(null, Age3 + " is Greater" );
        if ( Age1 < Age2 && Age1 < Age3 )
            JOptionPane.showMessageDialog( null, Age1 + " is Smaller" );
        if( Age2 < Age1 && Age2 < Age3 )
            JOptionPane.showMessageDialog( null, Age2 + " is Smaller" );
        if( Age3 < Age1 && Age3 < Age2 )
            JOptionPane.showMessageDialog(null, Age3 + " is Smaller" );
        }
    }

Java Program (Complete Marksheet Using Swing)

COMPLETE MARKSHEET USING SWING PACKAGE


import javax.swing.JOptionPane;
    class swingMarksheet{
        public static void main(String[]args) throws Exception{
            String a = JOptionPane.showInputDialog("Enter Java Marks");
            int java = Integer.parseInt(a);
            String b = JOptionPane.showInputDialog("Enter PHP Marks");
            int php = Integer.parseInt(b);
            String c = JOptionPane.showInputDialog("Enter VB Marks");
            int vb = Integer.parseInt(c);
            String d = JOptionPane.showInputDialog("Enter C++ Marks");
            int cpp = Integer.parseInt(d);
            String e = JOptionPane.showInputDialog("Enter Ruby Marks");
            int ruby = Integer.parseInt(e);
           
            int total = 500;
            int obtained = java + php + cpp + vb + ruby;
            int percentage = obtained * 100 / total;
           
            if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <100 && percentage >=80))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got A+ Grade");

            if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <80 && percentage >=70))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got A Grade");

           
           if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <70 && percentage >=60))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got B Grade");

           
           if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <60 && percentage >=50))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got C Grade");

           
           if(java >39 && php >39 && vb >39 && cpp >39 && ruby >39 && (percentage <50 && percentage >=40))
               
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Pass" + "\n You Got D Grade");


            if(java <40 || php <40 || vb <40 || cpp <40 || ruby <40 || percentage < 40)
JOptionPane.showMessageDialog(null, "Total Marks Are :" + total +
                 "\n Obtained Marks Are : " + obtained +
                 "\n Percentage is : " + percentage +"%" +
                 "\n You Are Fail");
                                                 
        }
    }

Java Program (Find Out Greater and Smaller Age)

FIND OUT SMALLER AND LARGER AGE FROM TAKEN INPUT (SWING PACKAGE)


import javax.swing.JOptionPane;
    class FiveAge{
        public static void main(String[]args) throws Exception{
            String text = JOptionPane.showInputDialog("Enter First Age");
            int Age1 = Integer.parseInt(text);

            String text2 = JOptionPane.showInputDialog("Enter Second Age");
            int Age2 = Integer.parseInt(text2);

            String text3 = JOptionPane.showInputDialog("Enter Third Age");
            int Age3 = Integer.parseInt(text3);
   
            String text4 = JOptionPane.showInputDialog("Enter Fourth Age");
            int Age4 = Integer.parseInt(text4);
   
            String text5 = JOptionPane.showInputDialog("Enter Fifth Age");
            int Age5 = Integer.parseInt(text5);
   
            if( Age1 > Age2 && Age1 > Age3 && Age1 > Age4 && Age1 > Age5 )
            JOptionPane.showMessageDialog( null, Age1 + " is Greater" );
       
            if( Age2 > Age1 && Age2 > Age3 && Age2 > Age4 && Age2 > Age5 )
            JOptionPane.showMessageDialog( null, Age2 + " is Greater" );
       
            if( Age3 > Age1 && Age3 > Age2 && Age3 > Age4 && Age3 > Age5 )
            JOptionPane.showMessageDialog(null, Age3 + " is Greater" );
       
            if ( Age4 > Age1 && Age4 > Age2 && Age4 > Age3 && Age4 > Age5 )
            JOptionPane.showMessageDialog( null, Age4 + " is Greater" );
       
            if( Age5 > Age1 && Age5 > Age2 && Age5 > Age3 && Age5 > Age4 )
            JOptionPane.showMessageDialog( null, Age5 + " is Greater" );
   
            if( Age1 < Age2 && Age1 < Age3 && Age1 < Age4 && Age1 < Age5 )
            JOptionPane.showMessageDialog(null, Age1 + " is Smaller" );
       
            if( Age2 < Age1 && Age2 < Age3 && Age2 < Age4 && Age2 < Age5 )
            JOptionPane.showMessageDialog(null, Age2 + " is Smaller" );
       
            if( Age3 < Age1 && Age3 < Age2 && Age3 < Age4 && Age3 < Age5 )
            JOptionPane.showMessageDialog( null, Age3 + " is Smaller" );
       
            if( Age4 < Age1 && Age4 < Age2 && Age4 < Age3 && Age4 < Age5 )
            JOptionPane.showMessageDialog( null, Age4 + " is Smaller" );
       
            if( Age5 < Age1 && Age5 < Age2 && Age5 < Age3 && Age5 < Age4 )
            JOptionPane.showMessageDialog(null, Age5 + " is Smaller" );      
        }
    }