Cannot get the right output for Java array
The Question of the assignment is:-

You  have  been  requested  to  create  an  application  for  a  bookshop  that  helps  to  keep 
track of books. 
 
You are required to create the following classes for your application: 
1.  The  class  to  describe  attributes  or  variable  of  book  title  and  book  price  with 
correct data type. 
2.  The  class  should  store  collection  of  books  (using  an  array).  This  class  should 
also keep track of the total number of books in the collection, the total cost of the 
books in the collection. 
3.  [Bonus marks] The  class  should  also  display  the  most  expensive book  title  and 
price as well as cheapest book title and price. 
 
Requirements 
You should implement arrays to store the book details. There is NO need to implement 
any databases or files. 
 
All java source files must contain your name, student id, course, and date.  Include this 
information within comments (in the header) in the source code. 
 
Each  of  your  classes  should  be  commented  appropriately  and  the  code  checked  for 

I have successfully stored books in array, and make it display. But I am having problem, with the price of the book. It outputs the book name, but does not output the price and the total price of the books purchased, please see my coding below..

    import java.util.Scanner;
    public class array_userinput {
        	public static void main(String[] args) {
        
        		Scanner input = new Scanner(System.in);
        		int numOfBook;
              	System.out.print("How many numbers of books u want: ");//prompts the user to enter the number of books he/she wants
        		
        		double[] bookPrice = new double[numOfBook];
                int num = input.nextInt();
        		//double price[];
        		double totalCost = 0;
        		String array[] = new String[num];
        
        		
                System.out.print("Enter the " + num + " book names now: ");
        
        
                for (int i = 0 ; i < array.length; i++ ) {
        
                   array[i] = input.next();
        					
                	System.out.println("These are the books you have entered: "+array[i]);
                	System.out.print("Please enter book price: ");
        			bookPrice[i] = input.nextDouble();
        			System.out.println(numOfBook);
        
        			totalCost += bookPrice[i];
    double max = prices[i];
    int maxBook = 0;
    for(int i = 1; i < books.length; i++) {
        if(prices[i] > max) {
            max = prices[i];
            maxBook = i;
        }
    }
    
    System.out.print("Cheapest book: " + books[maxBook]);
    double min = prices[i];
    int minBook = 0;
    for(int i = 1; i < books.length; i++) {
        if(prices[i] < min) {
            min = prices[i];
            minBook = i;
        }
    }
    System.out.print("Cheapest book: " + books[minBook]);
                	
        	   }
           	}
        
        }








Cannot get the right output for Java array
===

The Question of the assignment is:-

You  have  been  requested  to  create  an  application  for  a  bookshop  that  helps  to  keep 
track of books. 
 
You are required to create the following classes for your application: 
1.  The  class  to  describe  attributes  or  variable  of  book  title  and  book  price  with 
correct data type. 
2.  The  class  should  store  collection  of  books  (using  an  array).  This  class  should 
also keep track of the total number of books in the collection, the total cost of the 
books in the collection. 
3.  [Bonus marks] The  class  should  also  display  the  most  expensive book  title  and 
price as well as cheapest book title and price. 
 
Requirements 
You should implement arrays to store the book details. There is NO need to implement 
any databases or files. 
 
All java source files must contain your name, student id, course, and date.  Include this 
information within comments (in the header) in the source code. 
 
Each  of  your  classes  should  be  commented  appropriately  and  the  code  checked  for 

I have successfully stored books in array, and make it display. But I am having problem, with the price of the book. It outputs the book name, but does not output the price and the total price of the books purchased, please see my coding below..

    import java.util.Scanner;
    public class array_userinput {
        	public static void main(String[] args) {
        
        		Scanner input = new Scanner(System.in);
        		int numOfBook;
              	System.out.print("How many numbers of books u want: ");//prompts the user to enter the number of books he/she wants
        		
        		double[] bookPrice = new double[numOfBook];
                int num = input.nextInt();
        		//double price[];
        		double totalCost = 0;
        		String array[] = new String[num];
        
        		
                System.out.print("Enter the " + num + " book names now: ");
        
        
                for (int i = 0 ; i < array.length; i++ ) {
        
                   array[i] = input.next();
        					
                	System.out.println("These are the books you have entered: "+array[i]);
                	System.out.print("Please enter book price: ");
        			bookPrice[i] = input.nextDouble();
        			System.out.println(numOfBook);
        
        			totalCost += bookPrice[i];
    double max = prices[i];
    int maxBook = 0;
    for(int i = 1; i < books.length; i++) {
        if(prices[i] > max) {
            max = prices[i];
            maxBook = i;
        }
    }
    
    System.out.print("Cheapest book: " + books[maxBook]);
    double min = prices[i];
    int minBook = 0;
    for(int i = 1; i < books.length; i++) {
        if(prices[i] < min) {
            min = prices[i];
            minBook = i;
        }
    }
    System.out.print("Cheapest book: " + books[minBook]);
                	
        	   }
           	}
        
        }







