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

  Write a program called checkpass

IT401 – Assignment - Write a program called CheckPass which read the mark from user in double and prints "PASS" if the mark is more than or equal to 60

  Creates a list of integers

Modify the List class of Figure 21.3 in the textbook to include a method that recursively searches a linked-list for a specified value.

  Provide method that compellingly differentiates the class

Provide at least one field and one method that compellingly differentiates each class from the others. Do not include constructors, getters, or setters in your description.

  Program that uses the divide-and-conquer technique

Write a program that uses the divide-and-conquer technique to count the number of inversion in the array and Write a program that uses a transform-and-conqueralgorithm with efficiency class Θ(nlogn) to solve this problem.

  Define a class constant for the maximum number

Your program is required to exactly reproduce the format and behavior of the log of execution at the end of this write-up - practice with while loops

  Draw a uml diagram for the classes

Draw a UML diagram for the classes. Implement the classes, and write a test program that creates a salaried employee and two hourly employees.

  Write aprogram that reads lines from a file

Write aprogram that reads lines from a file and prints them out, removing all occurrences of a specifiedstring from the lines

  Can a person who has a criminal conviction

Can a person who has a criminal conviction open a business as a sole trader?

  Create your own date class

You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the following interface and main program:

  Describe the steps to program development

What is the function of parseFloat and parseInt and what will be result if we send "abcd" through a prompt() input and pass it through parseInt()?

  Create a program using a gui interface

In your lab5 folder, compile the file that is a starting point for this assignment. The listing and image of this Java class is on the bottom of this lab description. You can create the programs by cutting and pasting.

  Write a program to calculate students average test scores

Write a program to calculate students average test scores and their grades. Use three arrays: a one-dimensional array to store the student names, a (parallel) two- dimensional array to store the test score.

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