15,921,028 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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