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

This program doesn\'t have a \"Main\" to test it and see if it\'s working as exp

ID: 3649215 • Letter: T

Question

This program doesn't have a "Main" to test it and see if it's working as expected or not. Can I get a main function for the problem below?

You are working at the checkout counter of a library and want to write a program that will print out information about the items a borrower has just checked out. The borrower can borrow at least the following items: best selling book, children's book, and videos. They can also try to checkout reference books, but should receive a message that says the reference materials are for use within the library. You are to print out a receipt for borrowers telling them the name of their type of book, and how many days they can borrow the item for. Children's books can be borrowed for 20 days, videos can be borrowed for 3 days, reference materials for 0 days, and best sellers for 10 days. After an item is borrowed it should be marked as unavailable. Every item has a title. Books and videos have a category and children's books have an additional descriptor called reading level. Each type of book should be an extension of a base class that has attributes for the title, the number of borrowing days, and whether the book is available.



import java.util.*;
import java.io.*;

public class Books
{
String title;
int checkoutDays;
int bookAvailability;
String readingLevel, category;

public Books()
{
title="";
checkoutDays = 0;
bookAvailability = 0;
}

boolean canBorrow()
{
return false;

}

void displayreceipt()
{
System.out.println("Book is unavailable");
}

}

class ReferenceBook extends Books
{

ReferenceBook()
{
super();
title= ("World Reference");
checkoutDays=0;

}

boolean canBorrow()
{
return false;
}

void refMaterial()
{
System.out.println("Book is for use in library only");
}
}

class BestSeller extends Books
{
String fiction;
BestSeller()
{
super();
title= ("Mystic River");
checkoutDays=10;
category= fiction;
}

boolean canBorrow()
{
return true;
}

void displayreceipt()
{
System.out.println("Book Name" + title + "Days allowed: " + checkoutDays);
}
}

class ChildrensBooks extends Books
{
String easy, fiction;
ChildrensBooks()
{
super();
title= ("Animal Farm");
checkoutDays=20;
category= fiction;
readingLevel= easy;
}

boolean canBorrow()
{
return true;
}

void displayreceipt()
{
System.out.println("Book Name" + title + "Days allowed: " + checkoutDays);
}
}

class Videos extends Books
{
String learning;
Videos()
{
super();
title= ("");
checkoutDays = 3;
category= learning;
}

boolean canBorrow()
{
return true;
}

void displayreceipt()
{
System.out.println("Video Name" + title + "Days allowed: " + checkoutDays);
}
}

Explanation / Answer

please rate - thanks

you only asked for a main program, so that's all I've provided. after rating if you need help to fix your class message me

import java.util.*;
public class main
{
public static void main(String []args)
{Books a=new Books();
ReferenceBook b=new ReferenceBook();
BestSeller c=new BestSeller();
ChildrensBooks d=new ChildrensBooks();
Videos e=new Videos();

a.displayreceipt();
b.displayreceipt();
c.displayreceipt();
d.displayreceipt();
e.displayreceipt();
}
}

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