I've been trying to figure out the code for this problem for a long time and I'm stumped. The problem is:

The library for which we design this system has only books and magazines that are available for library members to borrow from its circulation. Users of the library are students and Faculty/Staff members.
All members of the library get assigned a unique member number and member category (student or Faculty/Staff). We also store the first and last names, address (street, city, state, zip) and phone number of every member.
Books have a title, ISBN number, author (assume that a book has only one author and we only need to maintain the last name of the author) and number of copies. Magazines have a title and issue number.
Books may be borrowed for 4 days by students and for five days by
Faculty/Staff members.
Magazines may be borrowed for 2 days by students and 3 days by
Faculty/Staff members.
For each item not returned within the specified period, the library will issue a $1 fine per day. The school wants to automate borrow/return activities of the
library.
You are required to design and implement this system in an Object-Oriented approach. Some of the functionalities of the system are:
· Register and maintain/store User information (to a file)
· Register and maintain/store Book information (to a file)
· Borrow a Book
· Return a Book
· Check availability of a book
· Display Borrowed books of a user
· Edit User and/or Book information
· Put a hold on a book, when you need a book currently checked out to another borrower.

I made different classes and used arrays to store info. Right now, my code just displays user and book/magazine info. I don't know what else to do.

I'll post the code I have written in another post after this one.

import java.io.*;
public class Application {

	public static void main(String[] args) throws IOException{
		Members[] myMembers = Application.getMembers();
		Books[] myBooks = Application.getBooks();
		Magazines [] myMags = Application.getMags();

		System.out.println("What list would you like to view?" + "(For Members, enter '1', " + "for Books, enter '2', " + "and for Magazines, enter '3').");
		BufferedReader userOption = new BufferedReader(new InputStreamReader(System.in));
		float option = Float.parseFloat(userOption.readLine());
		if (option == 1){
			Members.displayAllMembersInfo(myMembers);
		} else if (option == 2) {
			Books.displayAllBooksInfo(myBooks);
		} else if (option == 3) {
			Magazines.displayAllMagsInfo(myMags);
		}
		System.out.println("Overtime pay for emp2 is " );
	}

	private static Members[] getMembers(){
		Members[] members = new Members[5];

		Members memb1 = new Members("Alisa", "Allen");
		Address add1 = new Address("1499 University Dr.", "Fairfax", "VA", 22030);
		memb1.setMemberAddress(add1);

		members[0] = memb1;

		Members memb2 = new Members("Almeda", "Bingham", new Address("1211 Carmichael Way", "Fairfax", "VA", 22016));

		members[1] = memb2;

		Members memb3 = new Members("Cady", "Calypso", new Address("1234 SW Town Center Loop West", "Wilsonville", "OR", 97070));

		members[2] = memb3;

		members[3] = new Members("Cherry", "Deniro", new Address("508 North 3rd Street", "Harrisburg", "PA", 17101));

		members[4] = new Members("Evan", "Frederick", new Address("1501 Taylor Ave.", "Renton", "WA", 98055));

		return members;
	}

	private static Books[] getBooks() {
		Books[] books = new Books[5];

		books[0] = new Books ("Harry Potter and the Sorcerer's Stone", "J.K. Rowling", "00000000001", 5);

		books[1] = new Books ("Harry Potter and the Chamber of Secrets", "J.K. Rowling", "00000000002", 2);

		books[2] = new Books ("Harry Potter and the Prisoner of Azkaban", "J.K. Rowling", "00000000003", 8);

		books[3] = new Books ("Harry Potter and the Goblet of Fire", "J.K. Rowling", "00000000004", 3);

		books[4] = new Books ("Harry Potter and the Order of the Pheonix", "J.K. Rowling", "00000000005", 7);

		return books;
	}

	private static Magazines[] getMags() {
		Magazines[] mags = new Magazines[5];

		mags[0] = new Magazines ("Cosmo", "01");

		mags[1] = new Magazines ("People", "02");

		mags[2] = new Magazines ("Forbes", "13");

		mags[3] = new Magazines ("Newsweek", "56");

		mags[4] = new Magazines ("Seventeen", "01");

		return mags;
	}
}

--------------------------------------------------------------------------------------
public class Books {
		private String title;
		private String author;
		private String ISBN;
		private int copies;

		public Books(String title, String author, String ISBN, int copies) {
			this.title = title;
			this.author = author;
			this.ISBN = ISBN;
			this.copies = copies;
	}
		public void settitle(String title) {
			this.title = title;
	}
		public void setauthor (String author) {
			this.author = author;
	}
		public void setISBN (String ISBN) {
			this.ISBN = ISBN;
	}
		//Display all Books' information
		public static void displayAllBooksInfo(Books[] books){
			System.out.println("Books:");
			System.out.println("");
			for(int i = 0; i < books.length; i++)
			{
				System.out.println("Title: " + books[i].title);
				System.out.println("Author: " + books[i].author);
				System.out.println("ISBN: " + books[i].ISBN);
				System.out.println("Copies: " + books[i].copies);
				System.out.println("-----------------------------------------------------");
			}
			System.out.println("");
		}

}

--------------------------------------------------------------------------------------
public class Magazines {
			private String title;
			private String issueNumber;

			public Magazines(String title, String issueNumber) {
				this.title = title;
				this.issueNumber = issueNumber;
		}
			public void settitle(String title) {
				this.title = title;
		}
			public void setissueNumber (String issueNumber) {
				this.issueNumber = issueNumber;
		}

			//Display all Magazines' information
			public static void displayAllMagsInfo(Magazines[] mags){
				System.out.println("Magazines:");
				System.out.println("");
				for(int i = 0; i < mags.length; i++)
				{
					System.out.println("Title: " + mags[i].title);
					System.out.println("Issue Number: " + mags[i].issueNumber);
					System.out.println("-----------------------------------------------------");
				}
				System.out.println("");
			}

	}


--------------------------------------------------------------------------------------
	public class Members {
		private String fName;
		private String lName;
		Address memberAddress;

		public Members(String fName, String lName, Address memberAddress) {
			this.fName = fName;
			this.lName = lName;
			this.memberAddress = memberAddress;
	}
		public Members(String name, String name2) {
			this.fName = name;
			this.lName = name2;
	}
		public String getFName() {
			return this.fName;
	}
		public void setFName(String name) {
			this.fName = name;
		}
		public String getLName() {
			return this.lName;
		}
		public void setLName(String name) {
			this.lName = name;
		}
		public Address getMemberAddress() {
			return this.memberAddress;
		}
		public void setMemberAddress(Address memberAddress) {
			this.memberAddress = memberAddress;
		}
		//Display all customers' information
		public static void displayAllMembersInfo(Members[] memb){
			System.out.println("Members:");
			System.out.println("");
			for(int i = 0; i < memb.length; i++)
			{
				System.out.println("Full Name: " + memb[i].getFName()+", "+memb[i].getLName());
				System.out.println("Address: " + memb[i].getMemberAddress().toString());
				System.out.println("-----------------------------------------------------");
			}
				System.out.println("");
		}
	}


--------------------------------------------------------------------------------------
public class Address {
	private String street;
	private String city;
	private String state;
	private int zip;

	public Address(String street, String city, String state, int zip){
		this.street = street;
		this.city = city;
		this.state = state;
		this.zip = zip;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public int getZip() {
		return zip;
	}

	public void setZip(int zip) {
		this.zip = zip;
	}

	public String toString(){
		return this.getStreet()+", "+this.getCity()+" "+this.getState()+" "+this.getZip();
	}
}

--------------------------------------------------------------------------------------

There is supposed to be another class named "Borrow" but I have no code for it, it's completely empty

Edited 6 Years Ago by Nick Evan: added code-tags

This article has been dead for over six months. Start a new discussion instead.