Create a constructor function for a book object

Assignment Help JAVA Programming
Reference no: EM131602712

Using the same method as last time, this is JavaScript not Java no option to select JavaScript so I chose Java:
Need the answer to this one Srijithnai:
A. Class and Constructor Creation

Book Class

Create a script called library.js. In this file create a constructor function for a Book object. The Book object should have the following properties:

Title

Available: Boolean representing whether the book is checked out or not. The initial value should be false.

Publication Date: Use a date object
Checkout Date: Use a date object

Call Number: Make one up

Authors: Should be an array of Author objects

Author Class

Create a constructor function for an object called Author. It should have a property for the first name and last name of the author.
Patron Class
Create a constructor function for an object called Patron. This represents a person who is allowed to check out books from the library.
Give it the following properties:
Firstname
Lastname
Library Card Number (Make one up)
Books Out: Make it an array
fine: Starts a 0.00

B. Methods to add

Book Class

Add a function to the Book prototype called "checkOut". The function will change the available property of the book from true to false and set the checkout date. The
checkout date should be set to the current date minus some random number of days.
Add a function to the Book prototype called "checkIn". The function will change the available property of the book from false to true.

Add a function called isOverdue that checks the current date and the checked out date and if it's greater than 14 days it returns true
Patron Class

Add a function to the Patron prototype called "read" that adds a book to it's books out property.

Add a function to the Patron prototype called "return" that removes a book from it's books out property.

C. Test Program

Create 5 different books from the Book Class and store them in an array called catalog.
Create 5 different patrons from the Patron Class and store them in an array called patrons.

Write a loop that simulates checkouts and checkins for a 3 month period. Every day iterate over the catalog, and every person in the patrons array. If the patron currently has the book checked out then check it in. If it is not checked out then add it to the patrons list of books via the patrons read method. If the book is overdue then add a fine of $5.00 to the patron returning it. At the end of the 3 month period, display each patron, the books they have currently checked out and any fine they may have.

Reference no: EM131602712

Questions Cloud

What are some techniques to evaluate potential sampling bias : What issues should be considered when constructing surveys? What are the implications of double-barreled, loaded, and negative questions?
Estimates economic damages for clients : Shaughnessy Consulting, LLC currently enjoys a patent on software that estimates economic damages for clients involved in personal injury lawsuits.
What kind of information can human services workers : What kind of information can human services workers provide to the community that could help increase access to services
Calculate the shipping charge for a package : Write a program that will calculate the shipping charge for a package, based on its weight - Line up the answers vertically using the correct escape characters
Create a constructor function for a book object : Create a constructor function for a Book object. The Book object should have-Create a constructor function for an object called Author
What factors will shift the supply and demand for currency : What will happen to a country that fixes the price of foreign exchange below equilibrium? What factors will shift the supply and demand for currency?
What challenges you anticipate in getting your organization : What challenges you anticipate in getting organization to implement and utilize business analytics? What would be some challenges in using business analytics?
Find the rate of change of volume with pressure : Show that the power rule for derivatives applies to rational powers of the form y = xm/n by raising both sides to the nth power and using implicit.
Explain four instances when the invisible hand : List and explain four instances when the invisible hand may fail to efficiently allocate resources.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd