Click here to Skip to main content
15,921,028 members

Comments by Member 13841462 (Top 2 by date)

Member 13841462 25-May-18 2:52am View    
oh actually, I figured it out. Thanks. I will mark solved this question.
Member 13841462 25-May-18 1:17am View    
import java.util.Scanner;

public class LibraryCollectionManager
{
public static Scanner keyboard = new Scanner(System.in);
public static PatronCollection patronObj = new PatronCollection(10);
public static LibraryCollection librarycollectObj = new LibraryCollection(10);
public static FileManager file = new FileManager();


public static void main(String[]args)
{
printMainMenu();
}


public static void printMainMenu()
{
while(true)
{
System.out.println("----------MAIN MENU----------");
System.out.println("1.Manage Material");
System.out.println("2.Manage Patrons");
System.out.println("3.Load/Save Data");
System.out.println("4.Exit");
System.out.println("------------------------");

System.out.println("Enter your choice :"); //read user choice
int userChoice = keyboard.nextInt();//returns the userChoice value


switch(userChoice)

{
case 1:
materialSubMenu();
break;

case 2:
patronSubMenu();
break;

case 3:
dataSubMenu();
break;

case 4:
System.exit(0);
break;

default:
System.out.println("This is not a valid entry, try again please");
break;

}//End switch
}//End While

}//End printMainMenu

public static void materialSubMenu()
{


while(true)
{
System.out.println("----------MATERIAL MENU----------");
System.out.println("1.Display all materials");
System.out.println("2.Find materials");
System.out.println("3.Checkout a material");
System.out.println("4.Return a checked out material");
System.out.println("5.Add a new material");
System.out.println("6.Remove a material");
System.out.println("7.Return to main menu");
System.out.println("------------------------");

System.out.println("Enter your choice :"); //read user choice
int userChoice = keyboard.nextInt();//returns the userChoice value


switch(userChoice)
{
case 1:
librarycollectObj.displayMaterials();
break;

case 2:
String test = "search";
Material materialObj = new Material();
materialObj = librarycollectObj.findMaterial(test);
break;

case 3:
boolean check;
String str1 = "test";
String str2 = "test";
check = librarycollectObj.checkOutMaterial(str1, str2);
break;

case 4:
break;

case 5:
addMaterialSubMenu();
break;

case 6:
removeMaterialSubMenu();
break;

case 7:
printMainMenu();
return;

default:
System.out.println("This is not a valid option, try again");
break;
}//End switch
}//End while
}//materialSubMenu

//Add Material Sub-Menu
public static void addMaterialSubMenu()
{
while(true)
{
System.out.println("----------ADD MATERIAL SUB-MENU----------");
System.out.println("1.Add book");
System.out.println("2.Add magazine");
System.out.println("3.Add video");
System.out.println("4.Return to main menu");
System.out.println("------------------------");

System.out.println("Enter your choice :"); //read user choice
int userChoice = keyboard.nextInt();//returns the userChoice value


switch(userChoice)
{
case 1:
Book book1 = new Book();
boolean successfullyAdded = librarycollectObj.addBook(book1);
if(successfullyAdded == true)
{
System.out.println("> You have successfully added the book to the library!\n");
}
else {
System.out.println("The library is full and book was not added! " );
}
break;

case 2:
Magazine mag1 = new Magazine();
successfullyAdded = librarycollectObj.addMagazine(mag1);
if(successfullyAdded == true)
{
System.out.println("> You have successfully added the magazine to the library!\n");
}
else {
System.out.println("The library is full and magazine was not added! " );
}
break;


case 3:
Video video1 = new Video();
successfullyAdded = libra