Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please Use Java to answer the following quesiton: For each of the questions you

ID: 3801815 • Letter: P

Question

Please Use Java to answer the following quesiton:

For each of the questions you need to write your approach. Else 50% points will be deducted.

For each of the following, you need to write the program and run the program.

The best way would be to run the program and copy the code in the pdf.

Insert the screen-shot of the output in the pdf file, in which you are writing the program. This carries major points. (30% of the points for each question)

For the question 1,2,4,5 you also need to provide the input files on which you have tested.

4. Create a Java class called Book containing bookCode, bookTitle, author(s), publication, year Of Publication, price and quantity available as data members. Write functions to

a. Add a “Book” record to a random access file

b. Delete a record from a file

c. Update a record (given the bookCode, update the quantityAvailable)

d. Display records.

Write a java program to test the functionality of above functions

Explanation / Answer

class Book { String author, title, publisher; Book(String a, String t, String p) { author = a; title = t; publisher = p; } } class BookInfo extends Book { float price; int stock_position; BookInfo(String a, String t, String p, float amt, int s) { super(a, t, p); price = amt; stock_position = s; } void show() { System.out.println("Book Details:"); System.out.println("Title: " + title); System.out.println("Author: " + author); System.out.println("Publisher: " + publisher); System.out.println("Price: " + price); System.out.println("Stock Available: " + stock_position); } } class Exp6_1 { public static void main(String[] args) { BookInfo ob1 = new BookInfo("Herbert Schildt", "Complete Reference", "ABC Publication", 2359.50F, 10); BookInfo ob2 = new BookInfo("Ulman", "system programming", "XYZ Publication", 359.50F, 20); BookInfo ob3 = new BookInfo("Pressman", "Software Engg", "Pearson Publication", 879.50F, 15); ob1.show(); ob2.show(); ob3.show(); } } /* OUTPUT!!! Book Details: Title: Complete Reference Author: Herbert Schildt Publisher: ABC Publication Price: 2359.5 Stock Available: 10 Book Details: Title: system programming Author: Ulman Publisher: XYZ Publication Price: 359.5 Stock Available: 20 Book Details: Title: Software Engg Author: Pressman Publisher: Pearson Publication Price: 879.5 Stock Available: 15 */

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote