Programming 1
This is Rafael Gonzalez Contreras
2022-0121
Freidy Nuñez
Creation of a virtual library system.
1. Create an abstract class "BibliographicMaterial" that has the
title
pages.
2. Create a class 'Book' that inherits from 'BibliographicMaterial' and has a
additional attribute 'editorial'.
3. Create a class "Magazine" that also inherits from "BibliographicMaterial".
and have an additional attribute 'issn'.
4. Create an abstract class 'Lendable' that inherits from
"MaterialBibliográfico" y tenga un atributo adicional "estado" (disponible
or not available).
5. Create a class 'DVD' that inherits from 'Prestable' and has an attribute
additional "duration".
6. Create an interface "IPrestable" that has the following methods: lend
and return.
7. Implement the interface 'IPrestable' in the class 'Prestable'.
8. In the class 'Prestable', overload the method lend to have in
report the availability status of the material.
9. Create a class 'VirtualLibrary' that has a list of materials
bibliographic and have the following methods: add material, delete
material, and show information about materials.
10. In the class 'VirtualLibrary', create a method that allows interaction
with the objects of the classes 'Book', 'Magazine', 'DVD' through a
menú que permita prestamo, devolución, mostrar información y salir.
11. In the class 'VirtualLibrary', use the reserved word 'super' to
call the methods of the parent class.
12. Use constructor and method overloading as necessary.
package tasks;
import [Link];
import [Link];
public class virtual_library extends BibliographicMaterial{
static int n_Books
void Add_material() {
Scanner keyboard = new Scanner ([Link]);
Book Book [] = new Book [n_Books];
Book L=null;
for (int i = 0; i < n_Books;i++ ) {
[Link]("What is the title of the Book?");
Title = [Link]();
[Link]("What year is the book from?");
Year = [Link]();
[Link]("How many pages does it have?");
Pages = [Link]();
Who is the Author?
Author = [Link]();
L = new Book Year, Pages, Author);
Libr[i]=L;
for (int I = 0; i < n_Books; i++) {
[Link](Libr[i]);
void Remove_material() {
int Delete;
Scanner keyboard = new Scanner ([Link]);
Delete = [Link]();
void Show_information() {
public static void main(String[] args) {
//TODO Auto-generated method stub
virtual_library Library = new virtual_library();
Scanner sn = new Scanner([Link]);
boolean to exit = false
int option
while (!exit) {
1. Add Subjects
2. Show Information
3. Delete Material
4. Exit
try {
[Link]("Write one of the options");
option = [Link]();
switch option {
case 1:
Scanner keyboard = new Scanner ([Link]);
How many books do you want to enter?
n_Books = [Link]();
Library.Add_material();
break;
case 2:
Library.Show_information();
break;
case 3:
Library.Remove_material();
break;
case 4:
to go out = true
break;
default:
Only numbers between 1 and 4
} catch InputMismatchException e) {
You must insert a number
[Link]();
abstract class Bibliographic Material {
String Title;
String Author;
int Year;
int Pages;
public BibliographicMaterial() {
class Book extends MaterialBibliográfico
public Book() {
public Book(String Title, int Year, int Pages , String (Author) {
[Link] = Title;
[Link] = Year;
[Link] = Pages;
[Link] = Author;
}
public String getTitle() {
return Title
public void setTitle(String Title {
Title
public int getYear() {
return Year;
public void setYear(int (Year) {
[Link]
public int getPages() {
return Pages;
public void setPages(int Pages {
Pages
public String getAuthor() {
return Author;
public void setAuthor(String Author {
Author
@Override
public String toString() {
return Book + Title: + Title + , Year: Year + , Pages: + Pages
+ , Author: + Author + '}';
String editorial;
class Magazine extends BibliographicMaterial{
int issn;
abstract class Prestable extends BibliographicMaterial{
String state
class DVD extends Ready
int Duration;