`import java.util.;
import java.time.
;

public class Customer

import java.util.*;
import java.time.*;

public class Customer{
 private String name;
 private int custID;
 static int nextCustID = 100;
 ArrayList<Rent> rents = new ArrayList<Rent>();

 public Customer(String n){
    name = n;
    custID = nextCustID++;
 }
 public void addRent(int copyNo, LocalDate date, int days){  
    Rent r  = new Rent(copyNo, date, days);
    rents.add(r);
  }
 public String getName(){
  return name;
 }
  public int getID(){
  return custID;
 }
  public void listRented(){
    System.out.print("has on rent ");
    for(Rent r: rents){
     System.out.println(r);
  }
  }
   public Rent searchRentByCopyNo(int copyNo){
    for(Rent r: rents){
     if(r.getCopyNo() == copyNo)
       return r;
    }
    return null;
   }
   public void returnRent(Rent r){
      rents.remove(r);
   }
  @Override
   public String toString(){
       return custID + " " + name;
  }
}

import java.util.*;
import java.time.*;

import java.util.*;
import java.time.*;

public class VideoShop{
 ArrayList<Customer>customers = new ArrayList<Customer>();//all customers
 ArrayList<Video>videos = new ArrayList<Video>();//all videos

 public void populateLists(){
   // this is a shortcut to populate lists, using arrays as initial storage
   Customer[] custArray = {new Customer("John"),new Customer("Greg")} ;
   Video[] videoArray = {new Video("Night", 2013), new Video("Day", 2011)};
   for(int i = 0; i< custArray.length; i++)
     customers.add(custArray[i]);
   for(int i = 0; i< videoArray.length; i++)
     videos.add(videoArray[i]);
 }
 private void addCustomer(){
  Scanner input = new Scanner(System.in);
  System.out.print("Enter name");
  String name = input.nextLine();
  customers.add(new Customer(name));

 }
 private void listCustomers(){
   for(Customer c: customers){
   System.out.println(c);
  }
 }
 private void addVideo(){
  Scanner input = new Scanner(System.in); 
  System.out.println("Enter title");
  String title = input.next();
  System.out.println("Enter year");
  int year = input.nextInt();
  videos.add(new Video(title, year));

 }
 private void addRent(){
     listCustomers();//just to know what are existing customers
      Scanner input = new Scanner(System.in); 
      System.out.println("Enter customer name");
      String name  = input.nextLine();
      Customer c = searchCustomerByName(name);
      listVideos();//just to know what are existing videos
      System.out.println("Enter copyNo");
      int copyNo = input.nextInt();
      LocalDate d = LocalDate.now(); //sets date to current date
      System.out.println("Enter days");
      int days = input.nextInt();
      c.addRent(copyNo, d, days);  //using method of Customer class
      Video v = searchVideoByCopyNo(copyNo); //search all videos to know what Video is rented to set availability to false
      v.setAvailable(false);
      }

 private void listVideos(){
   for(Video v: videos){
   System.out.println(v);
  }
 }
 private void listRents(){
   for(Customer c: customers){
     System.out.print(c.toString()+ " ");
     if(!c.rents.isEmpty())
       c.listRented();
  }//for
   System.out.println(); //add newline 
 }
 private Video searchVideoByCopyNo(int copyNo){
   for(Video v:videos){
    if(v.getCopyNo() ==copyNo)
      return v;
   }
   return null;
 }
 private Customer searchCustomerByName(String name){
   for(Customer c: customers){
     if(c.getName().equalsIgnoreCase(name))
       return c;
   }
   return null;
 }
private Customer searchCustomerByID(int id){
   for(Customer c:customers){
     if(c.getID() == id)
       return c;
   }
   return null;
 }

 //method to run application
  public void run(){
    boolean flag = true;
    while(flag){
      //display menu options
      System.out.println("Choose from the following options:\n" +
                         "1. Add customer\n" +
                         "2. List customers\n" +
                         "3. Add video\n" +
                         "4. List videos\n" +
                         "5. Add rent\n" +
                         "6. Remove rent\n" +
                         "7. List rents by customer\n"+
                         "8. Exit");
      //read user input
      Scanner input = new Scanner(System.in);
      int choice = input.nextInt();
      //create switch
      switch(choice){
        case 1:
          addCustomer();
        break;
        case 2:
          listCustomers();
        break;
        case 3:
            searchCustomerByName(null);
        break;
        case 4:
          listVideos();
        break;
        case 5:
          addRent();
        break;
        case 6:
          listRents();
          Scanner input1 = new Scanner(System.in);
          System.out.print("Customer ID: ");
          int cid = input1.nextInt();
          Customer c = searchCustomerByID(cid);
          c.listRented();
          System.out.print("Enter copyNo to make video available: ");
          int copyNo =input1.nextInt();
          Rent r = c.searchRentByCopyNo(copyNo);
          c.returnRent(r); //remove rent
          Video video = searchVideoByCopyNo(copyNo);
          video.setAvailable(true);//make video available
        break;
        case 7:
           listRents();
        break;    
        case 8:
          flag = false;
        break;
        default:
          System.out.println("Wrong option");
        break;
      }//switch
    }//while
  }//method run

}

public class Rent{
 private int copyNo;
 private LocalDate date;
 private int days;

 public Rent(int copyNo, LocalDate d, int ds){
  this.copyNo = copyNo;
  date = d;
  days = ds;
 }
 public int getCopyNo(){
   return copyNo;
 }
 public LocalDate getLocalDate(){
   return date;
 }
 public int getDays(){
   return days;
 }
 public void setCopyNo(int copyNo){
   this.copyNo = copyNo;
 }
 public void setLocalDate(LocalDate date){
   this.date = date;
 }
 public void setDays(int days){
   this.days = days;
 }
 @Override                                 
 public String toString(){
  return "Copy number: " + copyNo  + " Date: " + date + " Days: " + days;
 }
}

I canonly see one call to searchCustomersByName, and that passes null as the parameter.
I can't see any code to print it.

What should I do to fix my problem?

Write some code that searches for a known customer and prints the result!

It's a mistake that all learners make: they write far to much code before they start testing.

Here's an example how to do it so you find mistakes early and easily:
Compile the Customer class (if it needs the Rent class just include the absolute minimum version or Rent to make it possible).
Write main method in Customer with some simple hard-coded tests to create a customer and call each of its public methods, printing the results. Do not move on until those tests work perfectly. Keep that main method and re-run it every time you change the Customer class.
Finish the Rent class and test that as above.
Write the VideoShop class's utility methods and test those as above.
Finally write the user interface and test that.

The idea is that when you run tests there are only a few dozen lines of code that haven't already been proven to work, so any problems will be in those few lines and easy to find.

Remember: experienced coders test early and test often.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.