Home / Expert Answers / Computer Science / in-java-library-class-define-a-class-named-library-with-following-characteristics-data-members-in-pa116

(Solved): IN JAVA Library class Define a class named Library with following characteristics Data members: - in ...



IN JAVA

student submitted image, transcription available belowstudent submitted image, transcription available below
Library class Define a class named Library with following characteristics Data members: - int acc_num - stores the accession number of the book. - String title - stores the title of the book. - String author - stores the name of the author. Member Methods: - setValues() - To set values of accession number, title and author. This function return type is void. - compute() - This method accepts late Days (number of days late the book returned) and calculates the fine at the rate of per day. - void display() To display the details in the following format: "AccessionNumber Title Author" Note: Print Accession number, title and author separated by a single space. Input Java Programming Language Ken Arnold, James Gosling, David Holmes 4 where, - First line represents the Accession Number. - Second line represents the title of the book. - Third line represents the author of the book. - Fourth line represents the number of days late. Output 1001 Java Programming Language Ken Arnold, James Gosling, David Holmes 8 where, - First line represents output of display call. - Second line display calculated fine amount. int acc_num; String title; String author; public void setValue(int avv_num,String title, String Author) \{ this.acc_num=acc_num; this.title=title; this. author=author; \} public int compute(int latedays) \{ return latedays*2; \} public void display()\{ System.out.println(acc_num+" "+title+","+author); \} public static void main(String[] args) throws Exception \{ BufferedReader br=new bufferReader(new InputSteamcAReader(System.in)); int acc_num, lateDays; String title; String author; System.out.print("Enter Accession Number : "); acc_num=Integer.parseInt (br.readLine ())); System.out.print("Enter Title: "); title=br . readLine(); System.out.print("Enter Author : "); author=br . readline(); System.out.pirnt("Enter Late Days : "); library lib=new Library(); lib.setValuse (acc_num, title, author); lib.display(); System. out.print(""+lib.compute(latedays)); \}


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe