Follow me on Twitter RSS FEED

stdetail

Posted in By me mama 0 comments

import com.sun.corba.se.spi.activation.Server;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Logger;

/**
 *
 * @author Sewranga
 */
public class stdetail {
    public static void main(String[] args) {
        try {
            BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
           
            System.out.println("what is your name");
            String input1=br.readLine();
            System.out.println("what is your index");
            String input2=br.readLine();
            System.out.println("y or n");
            String input3=br.readLine();
            if(input3.equals("y")){
                System.out.println("input1");
                Srfinal de=new Srfinal();
                de.logging("what is your name"+input1+"\t"+"what is your index"+input2);
            }
        } catch (IOException ex) {
//            Logger.getLogger(stdetail.class.getName()).log(Level1, Server  ,null, ex);
            System.out.println(ex);
        }
    }
}

srfinal(student detail)

Posted in By me mama 0 comments

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

/**
 *
 * @author Sewranga
 */
public class Srfinal {

    /**
     * @param args the command line arguments
     */

        // TODO code application logic here
        static final Logger Log=Logger.getLogger(Srfinal.class.getName());
        FileHandler fileHandler;
        public void logging(String massage) throws IOException{
            try {
                fileHandler=new FileHandler("log.txt");
                SimpleFormatter as=new SimpleFormatter();
                fileHandler.setFormatter( as );
                Log.info(massage);
           
            } catch (IOException ex) {
                Logger.getLogger(Srfinal.class.getName()).log(Level.SEVERE ,null, ex);            
            }
            catch(SecurityException ex){
                Logger.getLogger(Srfinal.class.getName()).log(Level.SEVERE,null,ex);
            }
        }
       
   
}

demo.java

Posted in By me mama 0 comments

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
/**
 *
 * @author Sewranga
 */
public class demo {


/**
 *
 * @author Sewranga

    /**
     * @param args the command line arguments
     */

        // TODO code application logic here
        static final Logger Log=Logger.getLogger(demo.class.getName());
        FileHandler fileHandler;
        public void logging(String massage) throws IOException{
            try {
                fileHandler=new FileHandler("log.txt");
                SimpleFormatter as=new SimpleFormatter();
                fileHandler.setFormatter( as );
                Log.info(massage);
           
            } catch (IOException ex) {
                Logger.getLogger(demo.class.getName()).log(Level.SEVERE ,null, ex);            
            }
            catch(SecurityException ex){
                Logger.getLogger(demo.class.getName()).log(Level.SEVERE,null,ex);
            }
        }
       
   
}

main.java

Posted in By me mama 0 comments

package exsr;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Sewranga
 */
public class main {
    public static void main(String[] args) {
     
       Exsr a1=new Exsr("12",2000.0);
        Exsr a2=new Exsr("54",1000.0);
     


 a1.deposit(500);
 a2.withdraw(200);
        System.out.println(a1.getAccountBal());
        System.out.println(a2.getAccountBal());
        try {
             demo d=new demo();
           d.logging("a");
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}

exsr.java

Posted in By me mama 0 comments

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exsr;

/**
 *
 * @author Sewranga
 */
public class Exsr {

    private String AccoutnID;
    private Double AccountBal;

    /**
     * @return the AccoutnID
     */
    public String getAccoutnID() {
        return AccoutnID;
    }

   
   

    /**
     * @param AccoutnID the AccoutnID to set
     */
    public void setAccoutnID(String AccoutnID) {
        this.AccoutnID = AccoutnID;
    }

    /**
     * @return the AccountBal
     */
    public double getAccountBal() {
        return AccountBal;
    }

    public Exsr(String AccoutnID, double AccountBal) {
        this.AccoutnID = AccoutnID;
        this.AccountBal = AccountBal;
    }

     public Exsr(String AccoutnID) {
     this(AccoutnID,0.0);
    }


    /**
     * @param AccountBal the AccountBal to set
     */
    public void setAccountBal(double AccountBal) {
        this.AccountBal = AccountBal;
    }

    public double deposit (double a){
    setAccountBal(getAccountBal()+a);
    return getAccountBal();
}
    public double withdraw (double a1){
    setAccountBal(getAccountBal()-a1);
    return getAccountBal();
}
}

Design by: WPYAG
Blogger Template by Anshul | Funny Pictures.