Ceviz Forum

Geri Dön   Ceviz Forum > Programlama > Java / JSP

Cevapla
 
LinkBack Seçenekler
Eski 14/05/2008, 21:34   #1 (permalink)
Üye
 
Üyelik Tarihi: 05/2008
Mesaj: 1
Varsayılan Bir hata çok önemli..

32. satırda aşağıdaki hatayı veriyor..

<identifier> expected public void minimumcost(table)

')'expected yazıyor


yardımcı olabilriseniiz sevinirim


Kod:
import javax.swing.*;
import java.util.Random;
import java.util.Arrays;
import java.lang.String;
public class Project
{
 int [][]table={//We have 10x10 array
  {0,550,0,0,50,0,0,0,0,0,50},//ROW1
  {0,0,150,200,0,200,0,0,0,0},//ROW2
  {0,0,0,0,0,150,0,0,0,0},//ROW3
  {0,0,0,0,0,200,0,0,0,0},//ROW4
  {0,0,0,0,0,0,100,0,0,0},//ROW5
  {0,0,0,0,0,0,0,500,0,0},//ROW6
  {0,0,0,0,0,100,0,100,0,0},//ROW7
  {0,0,0,0,0,0,0,0,600,0},//ROW8
  {0,0,0,0,0,0,0,0,0,0},//ROW9
  {0,0,0,0,0,0,50,0,0,0}//ROW10 
  };
 public void main(String[]args)
 {
  System.out.println("We have the minimum cost in this sequence:");
  MinimumCost(table);
 }
 
 public void MinimumCost(int[][]table)
 {
  int factorialNine=factorial(9);//When we put the first element on the array ,there is left 9! possibilities
  //to put the other numbers.Below ,we say row i 9!
  int[][]oneLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 1
  int[][]twoLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 2
  int[][]threeLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 3
  int[][]fourLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 4
  int[][]fiveLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 5
  int[][]sixLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 6
  int[][]sevenLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 7
  int[][]eightLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 8
  int[][]nineLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 9
  int[][]tenLeadArrays=new int[factorialNine][10];//Whole possibilities of the array that starts with 10
  
  //LoadLeadArray fills the array with all possibilities that starts with index number in the function;i.e here it is 0
  oneLeadArrays=LoadLeadArray(1);
  twoLeadArrays=LoadLeadArray(2);
  threeLeadArrays=LoadLeadArray(3);
  fourLeadArrays=LoadLeadArray(4);
  fiveLeadArrays=LoadLeadArray(5);
  sixLeadArrays=LoadLeadArray(6);
  sevenLeadArrays=LoadLeadArray(7);
  eightLeadArrays=LoadLeadArray(8);
  nineLeadArrays=LoadLeadArray(9);
  tenLeadArrays=LoadLeadArray(10);
  
  int holdSmallestOneLead=SmallestCost(oneLeadArrays,table);
  int holdSmallestTwoLead=SmallestCost(twoLeadArrays,table);
  int holdSmallesthreeOneLead=SmallestCost(threeLeadArrays,table);
  int holdSmallestFourLead=SmallestCost(fourLeadArrays,table);
  int holdSmallestFiveLead=SmallestCost(fiveLeadArrays,table);
  int holdSmallestSixLead=SmallestCost(sixLeadArrays,table);
  int holdSmallestSevenLead=SmallestCost(sevenLeadArrays,table);
  int holdSmallestEightLead=SmallestCost(eightLeadArrays,table);
  int holdSmallestNineLead=SmallestCost(nineLeadArrays,table);
  int holdSmallestTenLead=SmallestCost(tenLeadArrays,table);
  
 }
 
 public int factorial(int number)
 {
  if(number==1)
   return 1;
  else
  {
   return number*(number-1);
  }
 }
 
 public int [][]  LoadLeadArray(int index)//
 {
  Random random=new Random();
  int[][]hold=new int[factorial(9)][];
  
  int i=0;
  for(;i<factorial(9);i++)//We start to put elements in the array from index 1
  {
   if(i==0)//If we are at 0,there is no need to check the other rows if they're equal or not.Otherwise,we have to check
   {
    hold[i][0]=index;
   
    for(int j=1;j<=9;j++)
    {
     int holdRandom=1+(int)(Math.random()*10);//It creates random number between 1 and 10; one and nine included
     while(holdRandom==index)
     {
      holdRandom=1+(int)(Math.random()*10);    
     }
     if(ArrayCheck(hold_hold,holdRandom,j,hold[i][j]))
     {
      hold[i][j]=holdRandom;
     }
    
   
    }//At the end of this for loop;each row will be loaded by different number and they're not same
   
   }
   else
   {
    hold[i][0]=index;
    
    int []hold_hold=new int[9];
   
    for(int j=1;j<=9;j++)
    {
     int holdRandom=1+(int)(Math.random()*10);//It creates random number between 1 and 10; one and nine included
     while(holdRandom==index)
     {
      holdRandom=1+(int)(Math.random()*10);    
     }
     if(ArrayCheck(hold_hold,holdRandom,j))
     {
      hold_hold[j]=holdRandom;
     }
    
   
    }//At the end of this for loop;each row will be loaded by different number and they're not same
   
    if(CheckTheOtherRows(hold,hold_hold,i-1))
    {
     for(int k=0;k<=9;k++)
      hold[i][k]==hold_hold[k];
    }
  
   }
  
  }
  
  return hold[i];
  
 }
 
 public void CheckTheOtherRows(int[}[]hold,int []hold_hold,int bigRow)
 {
  for(int i=0;i<=bigRow;i++)
  {
   if(ArrayToString(hold[i])== ArrayToString(hold_hold))
    return false;
  }
  
  return true;
 }
 
 public String ArrayToString(int[]array)
 {
  String str="";
  
  for (int i = 0; i < array.length; i++)
        str = str + stringarray[i];
     
     return str;
 }
 
 public boolean ArrayCheck(int []number,int random,int j)//DUZELTİLECEK
 {
  int newRandom;
  
  if(NotInTheArray(number,random,j))
  {
   return true;
  }
  else
  {
   while( !NotInTheArray(number,random,j))//Send only the row
   {
    newRandom=1+(int)(Math.random()*10);
    ArrayCheck(number,newRandom,j);//There is a recursion
   }
   continue;
  }
 
 }
 
 public boolean NotInTheArray(int []hold,int check,int checkedIndex)
 {
  if(checkedIndex==1)
   return true;
  else
  {
   for(int i=1;i<checkedIndex;i++)
   {
    if(hold[i]== check)
     return false;
   }
  }
  return true;
 }
 
 public int SmallestCost(int[][]array,int[][]table)
 {
  int sum =0;
  
  for(int row=0;row<factorial(9);row++)
  {
   for(int column=0;column<=9;column++)
   {
    
   }
  }
 }
  
}
oozgur1 hatta değil   Alıntı Yaparak Yanıtla
Eski 22/05/2008, 18:01   #2 (permalink)
Üye
 
Üyelik Tarihi: 09/2004
Mesaj: 96
Varsayılan

32. satırda herhangi bir hata yok ama programda cok asırı hata var. bazı methodları void olarak tanımladıgınız halde asagıda return degerler vermissiniz. ne yapmak istediginizi bilmedigim icin vede cok fazla hata oldugu icin duzeltip buraya koyamıyorum.
osmantat hatta değil   Alıntı Yaparak Yanıtla
Cevapla

Bookmarks

Seçenekler

Mesaj Yazma Hakları
Yeni mesajgöndermezsiniz
Cevap yazamazsınız
Dosya ekleyemezsiniz
Mesajınızı düzenleyemezsiniz

BB code is Açık
[IMG] kodu Açık
HTML kodu Kapalı
Trackbacks are Açık
Pingbacks are Açık
Refbacks are Açık

Benzer Konular
Konu Konuyu açana göre Forum Cevap En Son Mesaj
cache Çok önemli maxcilopez PHP 0 16/11/2007 15:37
Freehand önemli! furkeyn Photoshop / Corel / PSP 1 18/01/2006 03:40
önemli sibel_izmir Pascal / Delphi / Delphi.NET 3 29/12/2004 15:42
Çok Önemli theskull Site Yorum 6 25/12/2004 18:11


Forum saati Türkiye saatine göredir. GMT +3. Şu anda saat 08:30.

Reklamlar & Desteklenenler
Hassas Valf | Hassas Kaplama | Antalyamız | Gazete | Ticari Bilişim | Hakan Müştak | Rüya Tabirleri | Kadın | Hastalıklar | Cepte msn ve e-posta | Webmaster | Antalya Aupair | Turkish Property Antalya | Forum | Chat | Perde | Adsl | Araba | bolindir.com | guncelle.com | livescore | Web Tasarım | evden eve nakliyat | forum | evden eve | sohbet | Resimcim| Kalifiye İnsan Kaynakları | Web Tasarım | Oyun | Yusuf KOÇ | Akın Yorulmaz | şiir | UFO | Web Tasarım | Oyunlar | Canlı Tv |


Forum Yazılımı: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright ©2001 - 2008, Ceviz.net