2) Write a class called LibMember having the following data members: firstName (String), lastName (String), gender (char), cprNum (long), teleNum (String), bookslssued (array of type Book, size = 10) and numBookslssued (int). Include following public methods in the class: Default constructor (without any parameters), constructor with 5 parameters (except for bookslssued and numBookslssued – initialize nubBiikslssued to 0), set and get methods for all attributes, equals and toString.

Question

JAVA

Please solve Question 2

 

public class Book{
    
    //declaring a variable to store count of books
    public static long COUNTER=1001;
    
    //declaring data members
    private String title;
    private String author1;
    private String author2;
    private String publisher;
    private int yearPublication;
    private String isbn;
    private long accessionNum;
    private LibMember issuedTo;
    
    //default constructor
    public Book(){
        this.title="";
        this.author1="";
        this.author2="";
        this.publisher="";
        this.yearPublication=0;
        this.isbn="";
        this.accessionNum=Book.COUNTER++;
        this.issuedTo=null;
    }
    
    //parameterized constructor
    public Book(String title, String author1, String author2, String publisher, int yearPublication, String isbn){
        this.title=title;
        this.author1=author1;
        this.author2=author2;
        this.publisher=publisher;
        this.yearPublication=yearPublication;
        this.isbn=isbn;
        this.accessionNum=Book.COUNTER++;
        this.issuedTo=null;
    }
    
    //getters and setters
    public void setTitle(String title){
        this.title=title;
    }
    
    public String getTitle(){
        return this.title;
    }
    
    public void setAuthor1(String author1){
        this.author1=author1;
    }
    
    public String getAuthor1(){
        return this.author1;
    }
    
    public void setAuthor2(String author2){
        this.author2=author2;
    }
    
    public String getAuthor2(){
        return this.author2;
    }
    
    public void setPublisher(String publisher){
        this.publisher=publisher;
    }
    
    public String getPublisher(){
        return this.publisher;
    }
    
    public void setYearPublication(){
        this.yearPublication=yearPublication;
    }
    
    public int getYearPublication(){
        return this.yearPublication;
    }
    
    public void setIsbn(String isbn){
        this.isbn=isbn;
    }
    
    public String getIsbn(){
        return this.isbn;
    }
    
    public void setAccessionNum(long accessionNum){
        this.accessionNum=accessionNum;
    }
    
    public long getAccessionNum(){
        return this.accessionNum;
    }
    
    public void setIssuedTo(LibMember issuedTo){
        this.issuedTo=issuedTo;    
    }
    
    public LibMember getIssuedTo(){
        return this.issuedTo;
    }
    
    //Two Books are said to be equal if they have same ISBN
    public boolean equals(Book b){
        return this.isbn.equals(b.getIsbn());    
    }
    
    //method which represents data of each Book
    public String toString(){
        return "Title: "+this.title+"\nAuthor: "+this.author1+"\nISBN: "+this.isbn+"\nAccession Number: "+this.accessionNum;
    }
}

2) Write a class called LibMember having the following data members:
firstName (String), lastName (String), gender (char), cprNum (long), teleNum (String),
bookslssued (array of type Book, size = 10) and numBookslssued (int).
Include following public methods in the class:
Default constructor (without any parameters), constructor with 5 parameters (except for
bookslssued and numBookslssued – initialize nubBiikslssued to 0), set and get methods for
all attributes, equals and toString.
Expand
Transcribed Image Text

2) Write a class called LibMember having the following data members: firstName (String), lastName (String), gender (char), cprNum (long), teleNum (String), bookslssued (array of type Book, size = 10) and numBookslssued (int). Include following public methods in the class: Default constructor (without any parameters), constructor with 5 parameters (except for bookslssued and numBookslssued – initialize nubBiikslssued to 0), set and get methods for all attributes, equals and toString.

Expert Answer

1 Rating

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Solve this algbra

A: Actually,  Consider the machine number is 0     01100000111     010100110001

Q: You are to program an open addressing hash table. Use array size to be 50.Your hash table must resol...

A: Hashing is an improvement over Direct Access Table. The idea is to use a hash function that converts...

Q: Specify the register contents and flag status as the following instructions are executed. A B S Z CY...

A: flag Status TRUE  

Q: Write bash script which takes array as an input of size 10 bind its even indexes to accept even valu...

A: The, script has given below:

Q: Write a python program that lets the user play the game of Rock, Paper, Scissors against the compute...

A: #Rock, Paper, Scissors Game import random while True: choice=int(input("Enter your choice 1.Rock, 2...

Q: Only C/C++

A: #include <iostream>using namespace std;// This functions returns the// Maximum no of students ...

Q: Using an unsorted array to implement a map would allow an O(log2N) get operation (where N is the num...

A: False Loop will run array n times and Second loop again n times Nested Loop

Q: Using a text editor, create a file that contains a list of at least 15 six-digit account numbers. Re...

A: Actually, java is a object oriented programming language. It is a platform independent.

Q: public void actionPerformed(ActionEvent ae) {try {SimpleDateFormat sdf = new SimpleDateFormat("dd/MM...

A: //Java source code for implementing proper ActionEvents import javax.swing.*; import java.awt.*; imp...

Q: Write a class named StockPrices . The class constructor should accept an array of stock prices as it...

A: public class StockPrices { double stockPrices[];  public StockPrices(double prices[]) {  this.stockP...

Q: Please explain RAID 10 and RAID 50.

A: In RAID 1 all data written to one disk is mirrored to its counterpart in the pair. RAID 10 takes thi...

Q: please provide some explanations to help me understand the topic.

A: Based on our rule, when multiple questions are posted, we should answer only the first one. Please r...

Q: Translate the following code into pep9 assembly language and show the screenshot of pep9 code. #inc...

A: This is the  lowest level of computing (machine language). It  has seven registers and four status b...

Q: Improve the following statements by applying missing Cs. 1. Send a copy of the report when convenien...

A: 1 .Completeness is essential in communication as incomplete or partial communication can result in f...

Q: Write a program in C write a program that reads a series of strings and prints only those beginning ...

A: program approach:- // using header file & main function. // string array which can take a series...

Q: (a) display_2D1list(list2D) that takes a 2D-list as input and prints all elements of that list in th...

A:   a.) Python program is   #function to display the list def display_2Dlist (list2D):       #when lis...

Q: Create a class called Employee that includes four pieces of information as data members — a first na...

A: public class Employee { String fName; String mName; String lName; int mSalary;  public Employee(Stri...

Q: Make block diagrams gor 16:1 multiplexers using 8:1 multiplexer and 2:1 multiplexers to design

A: In digital electronics, a multiplexer also called mux receives multiple input signals (both analog o...

Q: Write the SQL statements for the following User table. User_id Name City Order_date Purchase_amount ...

A: To create a table in SQL, create table command is used. Ans 1. The required query is: CREATE TABLE U...

Q: What is the importance of transceivers in the network?

A: The term transceiver does not necessarily describe a separate network device but rather an integrate...

Q: Search online for samples of IT contracts. Use search phrases like “IT contract” or “sample contract...

A: The, given information is: Search online for samples of IT contracts. Use search phrases like “IT co...

Q: In Python:  So this is part of a large project I am working on but I'm having a hard time finding ou...

A: The ask is to build the study hours application by doing the following: - read the student details f...

Q: void fun1() { float a; void fun2() { int b, c; <-- 1 The calling sequence for this program for execu...

A: Actually, function is a group of statements.

Q: Create a generic Map interface MyMap&lt;K,V&gt; that represents a Map structure. K is the type for a...

A: Java code for given question is solved in step 2. feel free to post follow-up questions in case you ...

Q: In a python program you can simulate a magic square using a two-dimensional list. Write a function t...

A: #Set the number of NumOfRows and columns NumOfRows = 3 NumOfColumns = 3 MIN = 1 MAX = 9 #Define a fu...

Q: in c programming

A: #include &lt;stdio.h&gt;# define MAX_SIZE 5000 int main(void){    int N;    int num,c;    int a[MAX_...

Q: I* Your solution goes here */ while

A: The given is a java code under file named AutoBidder with below functionality:   1. It has a nextBid...

Q: Make a table comparing all network topologies

A: Actually, network is a all devices communicate with other.

Q: A Customer wants to order some products from any super shop through online.Super shop authority main...

A: The, given information is A Customer wants to order some products from any super shop through online...

Q: Information Security For a sniffer attack to succeed, what must the attacker do? How can an attacker...

A: Remember back in some movies, law agencies, and criminals used to bug the telephone lines in order t...

Q: Problem 2 (. ). Consider the following heap, which shows integer keys in the nodes: 5 22 15 34 27 28...

A: Remove the minimum from a given heap i.e 5 Copy the last value in the heap to the root of the heap....

Q: There is a legend about a magical park with N × N trees. The trees are positioned in a square grid w...

A: #include &lt;stdio.h&gt;int main(){ //number of trees int N; scanf("%d",&amp;N); //array to st...

Q: Write an assembly program for 8051 to transfer the letter “Z” serially at 1200 baud continuously. Us...

A: Here's an assembly program for 8051 to transfer the letter "Z" serially at 1200 baud continuously. M...

Q: Q3: (Tax Calculator) Develop a Java program that determines the total tax for each of four citizens....

A: The required Java code is: import java.util.Scanner;class TaxCalculator{ static double incomeTax(dou...

Q: Q1: Suppose x = 3 and y = 2. Show the output, if any, of the following code. What is the output if x...

A: Step 1:- The flowchart is a graphical way to explain the flow of data of the program. We are using d...

Q: Consider adding the string "F" to the following skip list. How many levels (or next references) shou...

A: Solution is in Step 2. 

Q: Qn 1: Write a C++ program to multiply 2 matrices using multi-dimensional arrays. Program should ask ...

A: Program code:     //inlcuding necessary header files #include &lt;iostream&gt; using namespace std; ...

Q: Scilab program for solving ordinary diffrential equation using ode package

A: It is numerically oriented high level programming language. It is free and open source software for ...

Q: When removing the string "G" form the following skip list, how many references within this skip list...

A: Deletion In skip list means we have to make connection between predecessor and successor of deleted ...

Q: Create a CourseException class that extends Exception and whose constructor receives a String that h...

A: public class Course {private String department;private int courseNumber;private float credits;public...