import java.util.Scanner;
public class BookStore
{
public static void main(String args[])
{
String nName,newAddress,receipt,customer,choice,movies,cont="N";
int Cost,custTel;
//int BookCata = 0;
String BookTitle = "";
//string BookAuthor = "";
//double BookCost = 0;
String YesAndNo = "";
Scanner in= new Scanner(System.in);
int NumOfBook = 15;
bookDetail[] book = new bookDetail[NumOfBook];
for(int i = 0; i < NumOfBook; i++)
{
book[i] = new bookDetail();
}
book[0].update("0001", "The Secret", "Rhonda Byrne", 10);
book[1].update("0002", "Secrets of Self-Made Millionaires", "Adam Khoo", 10);
book[2].update("0003", "An Illustrated Biography of the World’s Most Successful Investor", "Warren Buffet", 15);
book[3].update("0004", "How good do we have to be ?", "Harold Kushnere", 8);
book[4].update("0005", "Half a Life", "V. S. Naipaul", 5);
book[5].update("0006", "Subconscious Mind", "Murphy McMahan", 6);
book[6].update("0007", "The Road Less Travelled", "M. Scott Peck", 5);
book[7].update("0008", "Stop the insanity!", "Susan Powter", 5);
book[8].update("0009", "Business As Usual", "Anita Roddick", 6);
book[9].update("0010", "Rich Kid, Smart Kid", "Robert Kiyosaki", 6) ;
book[10].update("0011", "Secrets of the Millionaire Mind", "Harv Eker", 10);
book[11].update("0012", "Where have all the leaders gone?", "Lee Iacocca", 15);
book[12].update("0013", "If success is a game, these are the rules", "Cherie Carter", 8);
book[13].update("0014", "Think Big", "Donald Trump", 15);
book[14].update("0015", "Blink", "Malcolm Gladwell", 10);
System.out.print("Enter the title of book: ");
BookTitle = in.nextLine();
BookTitle = BookTitle.toUpperCase();
String CheckBookTitle = "";
int index = 0;
for(int i = 0; i < NumOfBook; i++)
{
CheckBookTitle = book[i].getTitle();
CheckBookTitle = CheckBookTitle.toUpperCase();
if(BookTitle.compareTo(CheckBookTitle) == 0)
{
System.out.println(BookTitle.compareTo(CheckBookTitle));
index = i;
System.out.println("Book title: " + BookTitle +" found");
System.out.println("Detail for the book title " + book[i].getTitle());
System.out.println("Author: " + book[i].getAuthor());
System.out.println("Catalogue " + book[i].getCata());
System.out.println("Cost: $" + book[i].getCost());
System.out.println("");
System.out.println(book[i].getTitle() + " Is available");
System.out.println("Cost to rent is " + book[i].getCost());
System.out.println("Proceed to rent? (Y/N) :");
choice= in.nextLine();
if(choice.equalsIgnoreCase("Y"))
{
//customer particulars
System.out.print("Please enter customer's name: ");
nName=in.nextLine();
System.out.print("Please enter customer's address: ");
newAddress =in.nextLine();
System.out.print("Please enter customer's telephone number: ");
custTel= in.nextInt();
Customer aCust = new Customer(nName,newAddress,custTel);
customer="\nPrinting out receipt for " + aCust.getName()+ "..."+ "\n" +
"Address: " + aCust.getAddress() +"\n\n";
receipt="Renting out " + BookTitle + " for " + " $ "+ book[i].getCost() +"\n"+"\n"+
"\nThank You For renting our Books please come again" + "\n\nServing next customer.......";
System.out.println(customer + receipt );
}
}
}
if(choice.equalsIgnoreCase(""))
{
System.out.print("??");
}
if(choice.equalsIgnoreCase("N"))
{
System.out.println("Serving next customer....");
cont=in.nextLine();
}
while(cont.equalsIgnoreCase("Y"));
System.out.println("GoodBye!! ");
System.exit(0);
} //main
} //class