paolo_romeo13 0 Newbie Poster

Hi hoping for some help with what is wrong with my code. Basically i have 2 sets of arrays that need to be compared. I'm creating a computer shop so there is a set of arrays giving descriptions of the computer like CPU speed etc and there is another set of arrays linked to customers who ask for specific feature in computers they want to buy, and these are checked against the computer arrys to see if there are any computers in stock that matches customer needs.

This is my code:

Outer: for(int s = 0; s<100; s++){
Inner: for(int q = 0 ;q<100;q++){
      if(Comp_Type[s]==Cus_Comp_Type[q]){
      if(Comp_Type[s] !=null){
      if(CPU_Type[s]==Cus_CPU_Type[q]){
      if(CPU_Speed[s]>=Cus_CPU_Speed[q]){
      if(Hard_Disk[s]>=Cus_Hard_Disk[q]){
      if(Graphics_Card[s]>=Cus_Graphics_Card[q]){
      if(RAM[s]>=Cus_RAM[q]){
      if(Display[s]>=Cus_Display[q]){
      if(Battery[s]>=Cus_Battery[q]){
      if(Weight[s]>=Cus_Weight[q]){
      if(Price[s]<=Cus_Price[q]){
         System.out.println("Customer Forname:" + Forname[q]);
         System.out.println("Customer Surname:" + Surname[q]);
         System.out.println("Computer Type: "+ Comp_Type[s]);
         System.out.println("CPU Type: " + CPU_Type[s]);
         System.out.println("CPU Speed " + CPU_Speed[s] + "GHz");
         System.out.println("Hard Disk: " + Hard_Disk[s] + "GB");
         System.out.println("Graphics card: " + Graphics_Card[s] + "MB");
        System.out.println("RAM: " + RAM[s] + "GB");
        System.out.println("Display: " + Display[s] + "inches");
        System.out.println("Battery life: " + Battery[s]);
        System.out.println("Weight: " + Weight[s]);
        System.out.println("Price: £"+Price[s]);
        System.out.println("");
        System.out.println("________________________________");
                        }}}}}}}}}}}  
                    }
                }

The reason for so many if statements is that it has to has to match all of those not just the 1.

The result i'm getting from the loop is that it only prints out and checks the first customer in the array and none of the rest.

any help would be grateful

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.