Write a program to read book information (bookid, bookname, bookprice, bookqty) in file “book.dat”. Write a menu driven program to perform the following operations using Random access file: i. Search for a specific book by name. ii. Display all book and total cost
import java . io .*; import java . util .*; class Book { String name , id ; int qty ; double price , total ; Book ( String i , String n , String p , String q ) { name = n ; id = i ; qty = Integer . parseInt ( q ); price = Double . parseDouble ( p ); total = qty * price ; } public String toString () { System . out . println ( "name\t id\t qty\t price\t total" ); String s = name + "\t" + id + "\t" + qty + "\t" + price + "\t" + total ; ...
Comments
Post a Comment