Pages

Tuesday, 17 September 2013

java 14

import java.io.*;
importjava.io.DataInputStream;

class Account
{
            intano;
            public float bal =1000;
            public void get()
            {
                        DataInputStream in = new DataInputStream(System.in);
                        try
                        {
                                    System.out.println("Enter the Account no:");
                                    ano = Integer.parseInt(in.readLine());
                                   
                        }
                        catch(Exception e)
                        {
                                    System.out.println("Awwal error");
                        }
                        }
            public void display()
            {
                        System.out.println("Account number is:"+ano);
                        System.out.println("Balance amount is:"+bal);
            }
           
}
interface Trans
{
            public void deposit();
}

class Savings extends Account implements Trans
{
            floatamt;
            public void deposit()
            {
                        DataInputStream in = new DataInputStream(System.in);
                        try
                        {
                                    System.out.println("Enter the amount to be deposited:");
                                    amt = Float.parseFloat(in.readLine());
                                    bal = amt + bal;
                        }
                        catch(Exception e)
                        {
                                   
                        }
            }
            public void ansari()
            {
                        System.out.println("The balance after Deposit is: "+bal);
            }
}
public class saving_main
{
            public static void main(String args[])
            {
                        Savings s = new Savings();
                        s.get();
                        s.display();
                        s.deposit();
                        s.ansari();
            }
}














package khan;

public class ansari1
{
public static void main(String args[])
          {
                   cube c1 = new cube();
                   c1.getd(10,20,30);
                   c1.result();
          }
}
class cube
{
          int l,b,h;
          void getd(int l,int b,int h)
          {
          this.l = l;
          this.b = b;
          this.h = h;
          }
          void result()
          {
                   int c = l*b*h;
                   System.out.println("Volume of Cube is: "+c);
          }
}