help please .. it's a programming question
Attachments:
nitish8089:
language
Answers
Answered by
1
check out this program.. may help you
class Library{
int ac_num;
String title;
String author;
public void input(int x,String y,String z){
this.ac_num=x;
this.title=y;
this.author=z;
}
public void compute(int day){
int late_fine=2*day;
System.out.println("the late fine charge is:"+late_fine+"Rs.");
}
public void display(){
System.out.println("Accession Number"+ac_num);
System.out.println("title"+title);
System.out.println("author"+author);
}
}
class program{
public static void main(String...args){
Library l1=new Library();
l1.input(12345,"The Nightiangle","Oscar Wilde");
l1.compute(5);
l1.display();
}
}
##################
by using scanner class you can also make program to support user input
class Library{
int ac_num;
String title;
String author;
public void input(int x,String y,String z){
this.ac_num=x;
this.title=y;
this.author=z;
}
public void compute(int day){
int late_fine=2*day;
System.out.println("the late fine charge is:"+late_fine+"Rs.");
}
public void display(){
System.out.println("Accession Number"+ac_num);
System.out.println("title"+title);
System.out.println("author"+author);
}
}
class program{
public static void main(String...args){
Library l1=new Library();
l1.input(12345,"The Nightiangle","Oscar Wilde");
l1.compute(5);
l1.display();
}
}
##################
by using scanner class you can also make program to support user input
Similar questions