0% found this document useful (0 votes)
9 views2 pages

Slip 15

TYBSc cs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Slip 15

TYBSc cs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Q 1

import java.io.*;
import java.util.*;
class demoFile
{
public static void main(String args[]) throws Exception
{
Scanner sc= new Scanner(System.in);
System.out.println("Enter the first file");
String f1=sc.next();
System.out.println("Enter the second file");
String f2=sc.next();
FileInputStream fis=new FileInputStream(f1);
FileOutputStream fos=new FileOutputStream(f2);
int ch;
while((ch=fis.read())!=-1)
{
fos.write(ch);
}
System.out.println("file copied...");
fis.close();
fos.close();
}
}

Q.2

import java.util.*;
class Account
{
String custname;
int accno;

Account(String a,int b)
{
this.custname=a;
this.accno=b;
}
void display()
{
System.out.println("Customer Name :"+custname);
System.out.println("Account No. :"+accno);
}
}
class SavingAccount extends Account
{
double sbal;
double mbal;

SavingAccount(String a,int b,double s,double m)


{
super(a,b);
this.sbal=s;
this.mbal=m;
}
void display1()
{
System.out.println("Saving balance :"+sbal);
System.out.println("Minimum balance :"+mbal);
}
}
class accountDetails extends SavingAccount
{
int damt;
int wamt;

accountDetails(String a,int b,double c,double e,int d,int w)


{
super(a,b,c,e);
this.damt=d;
this.wamt=w;
}
void display2()
{
System.out.println("Deposit amount :"+damt);
System.out.println("Withadrawal amount :"+wamt);
}
public static void main(String args[])
{
accountDetails ad=new accountDetails("kunal",12345,10000,3000,5000,2000);

ad.display();
ad.display1();
ad.display2();
}
}

You might also like