Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: help

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default help

    This is my code, when i compile with jgrasp show me this error:
    GaruesitApp.java:44: error: cannot access Garuesit public static void gjejMeTeMiret(Garuesit [] garues) ^
    bad source file: .\Garuesit.java
    file does not contain class Garuesit
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.




    import java.util.Scanner;
    public class GaruesitApp {
    public static void main (String[]args)
    {
    boolean proccesing=true;
    Scanner s= new Scanner(System.in);
    Scanner s1= new Scanner(System.in);
    System.out.println("Jep numrin e garuesve(nuk duhet te kete me shume se 15 garues):");
    int num=s.nextInt();
    if(num>15){System.out.println("Gabim ne numer "+num);
    proccesing=false;}
    else{
    Garuesit[] g1= new Garuesit[num];
    double k=0;

    for(int i=0; i<num; i++)

    {
    System.out.println("Jep id e personit");
    int a=s.nextInt();
    if(a<0 || a>15){System.out.println("Gabim:nuk duhet te kem me shume se 15!!!");
    proccesing=false;
    }

    else{
    System.out.println("Jep emrin e personit");
    String e= s1.nextLine();
    System.out.println("jep mbiemrin e personit");
    String mb= s1.nextLine();
    System.out.println("Jep kohen ");
    k = s.nextDouble();
    Garuesit g= new Garuesit(a, e, mb, k);
    g1[i]=g;
    System.out.println("Garuesi "+(i+1)+" "+g.toString());}

    }

    gjejMeTeMiret(g1);

    }}


    public static void gjejMeTeMiret(Garuesit [] garues)
    {
    Garuesit temp;
    for(int i=0; i<garues.length-1; i++)
    {
    for(int j=i+1; j<garues.length; j++)
    {
    if(garues[i].getKoha()>garues[j].getKoha())
    {
    temp=garues[i];
    garues[i]=garues[j];
    garues[j]=temp;
    }
    }
    }
    System.out.println("pozita e 1: "+ garues[0].getEmri()+" me kohen "+garues[0].getKoha());
    System.out.println("pozita e 2: "+ garues[1].getEmri()+" me kohen "+garues[1].getKoha());
    System.out.println("pozita e 3: "+ garues[2].getEmri()+" me kohen "+garues[2].getKoha());
    }
    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: help

    Please edit your post and wrap your code with code tags:
    [code=java]
    YOUR CODE GOES HERE
    [/code]
    to get highlighting and preserve formatting.

    file does not contain class Garuesit
    The name of the file must match the public class in the file.
    The code you posted should be in a file named: GaruesitApp.java
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: help

    Please post your code correctly and give your threads meaningful/useful titles.