Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@
<version>1.0-SNAPSHOT</version>



<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
</dependencies>
</project>
52 changes: 52 additions & 0 deletions src/main/java/com/zipcodewilmington/centrallibrary/Book.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.zipcodewilmington.centrallibrary;

public class Book extends LibraryItem {
private String author;
private String genre;
private String isbn;
private int pages;



public Book(String author, String genre, String isbn, int numberOfPages) {

this.author = author;
this.genre = genre;
this.isbn = isbn;
this.pages = numberOfPages;

}


public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;

}

public String getGenre() {
return genre;
}
public void setGenre(String genre) {
this.genre = genre;
}

public String getIsbn() {
return isbn;
}

public void setIsbn(String isbn) {
this.isbn = isbn;
}

public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;

}
}

21 changes: 21 additions & 0 deletions src/main/java/com/zipcodewilmington/centrallibrary/BookTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.zipcodewilmington.centrallibrary;

public class BookTest {

public static void main(String[] args) {

Book book = new Book("A100", "The Great Gatsby", "Aisle 3", 180);


System.out.println(book.getAuthor());
System.out.println(book.getGenre());
System.out.println(book.getPages());
System.out.println(book.isAvailable());
System.out.println(book.getLocation());
System.out.println(book.getId());
System.out.println(book.getTitle());

}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.zipcodewilmington.centrallibrary;


public class LibraryItem {
private int id;
private String title;
private String location;
private boolean isAvailable;
private String isbn;

//constructor


public LibraryItem() {

}

public LibraryItem(int id, String title, String location){
this.id = id;
this.title = title;
this.location = location;
this.isAvailable = true;

//getters and setters

}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}

public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}

public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}

public boolean isAvailable() {
return isAvailable;
}
public void setAvailable(boolean available) {
isAvailable = available;
}

public void checkOut() {
this.isAvailable = false;
}

public void checkIn() {
this.isAvailable = true;

}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}









}


Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.zipcodewilmington.centralibrary;
package com.zipcodewilmington.centrallibrary;

/**
* Created by n3pjk on 6/9/2025.
Expand Down
11 changes: 11 additions & 0 deletions src/test/Reservable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package library;

class LibraryMember {

}
public interface Reservable {
void reserve(LibraryMember member);
void cancelReserve(LibraryMember member);
boolean isReserved();

}
5 changes: 5 additions & 0 deletions src/test/Searchable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public interface Searchable {
boolean matchesKeyword(String keyword);
String[] getSearchableFields();
}

32 changes: 32 additions & 0 deletions src/test/java/com/zipcodewilmington/centrallibrary/Address.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.zipcodewilmington.centrallibrary;



public class Address{
private String street;
private String city;
private String state;
private String zipcode;

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

public String getStreet() {return street; }
public String getCity() {return city; }
public String getState() {return state; }
public String getZipcode() {return zipcode; }

public void SetStreet(String street) {this.street = state; }
public void SetCity(String city) {this.city = city; }
public void SetState(String state) {this.state = state; }
public void SetZipcode(String zipCode) {this.zipcode = zipCode; }

@Override
public String toString() {
return street + ", " + city + ", " + state + ", " + zipcode;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.zipcodewilmington.centrallibrary;

import org.junit.Assert;
import org.junit.Test;

public class AddressTest {

@Test
public void testAddressConstructorAndGetters() {
// given
String street = "123 North St.";
String city = "Narnia";
String state = "Fairytaleland";
String zipcode = "12345";

// when
Address address = new Address (street, city, state,zipcode);

Assert.assertEquals(street, address.getStreet());
Assert.assertEquals(city, address.getCity());
Assert.assertEquals(state, address.getState());
Assert.assertEquals(zipcode, address.getZipcode());
}

}
16 changes: 16 additions & 0 deletions src/test/java/com/zipcodewilmington/centrallibrary/Library.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.zipcodewilmington.centrallibrary;

import java.util.Scanner;

public class Library {

public static String name(String libraryNameString) {
Scanner scanner = new Scanner(System.in);
System.out.println(libraryNameString);
String userInput = scanner.nextLine();
return userInput;
}



}
Empty file.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.zipcodewilmington.centralibrary;
package com.zipcodewilmington.centrallibrary;

/**
* Created by n3pjk on 6/9/2025.
*/
public class MainApplicationTest {


}
37 changes: 37 additions & 0 deletions src/test/java/com/zipcodewilmington/centrallibrary/Person.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

package com.zipcodewilmington.centrallibrary;

public final class Person {
private String name;
private String phoneNumber;
private int age;
private String email;

public Person(String name, int age, String email, String phoneNumber) {
this.name = name;
this.phoneNumber = phoneNumber;
setAge(age);
this.email = email;
}

public String getName() {return name; }

public String getPhoneNumber() {return phoneNumber; }
public int getAge() {return age; }
public String getEmail() {return email;}

public void setName(String name) {this.name = name; }

public void setPhoneNumber(String phoneNumber) {this.phoneNumber = phoneNumber; }
public void setAge(int age) {
if (age < 0) throw new IllegalArgumentException("Age cannot be negative.");
this.age = age;
}
public void setEmail(String email) {this.email = email; }

@Override
public String toString() {
return name + ", " + phoneNumber + ", " + age + ", " + email;
}
}

34 changes: 34 additions & 0 deletions src/test/java/com/zipcodewilmington/centrallibrary/PersonTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.zipcodewilmington.centrallibrary;


import org.junit.Test;
import org.junit.Assert;


public class PersonTest {

@Test
public void testPersonConstructorAndGetters() {
// given
String name = "Joe";
String phoneNumber = "302-555-1111";
String email = "joeschmo@gmail.com";
int age = 30;

// when
Person person = new Person (name, age, email, phoneNumber);

Assert.assertEquals(name, person.getName());
Assert.assertEquals(phoneNumber, person.getPhoneNumber());
Assert.assertEquals(email, person.getEmail());
Assert.assertEquals(age, person.getAge());
}
@Test
public void testSetAge_negativeAge_throwsException() {
Person person = new Person("Joe", 30, "joeschmo@gmail.com", "123-456-7890");

Assert.assertThrows(IllegalArgumentException.class, () -> {
person.setAge(-1);
});
}
}
Loading
Loading