Results 1 to 2 of 2

Thread: JAVA need some help

  1. #1
    Join Date
    Feb 2009
    Posts
    96

    JAVA need some help

    i have to make a recursion program and this is what i have. Any ideas on how to make it work would be appreciated.

    thanx

    Daren


    import java.io.*;
    import javax.swing.JOptionPane;
    import java.util.*;
    import java.lang. *;

    class DistancebetweenCities //make the class
    {

    private Queue qCities = new Queue();
    private City aCity;
    private double totalDistance;
    private int length;
    private double distance;
    private double total;

    public void addCity()
    {
    //String msg1 = JOption.showMessage("Welcome to the city distance finder.");
    String strC = JOptionPane.showInputDialog(null, "Please let us know how many cities you wish to enter.");
    double coordx;
    double coordy;
    int qty = Integer.parseInt(strC);


    for (int i = 1; i <= qty; i++)
    {
    strC = JOptionPane.showInputDialog(null, "Please enter a city name:\n", "", 1);
    double cox = Double.parseDouble(JOptionPane.showInputDialog(null, "Please enter the X Coordinate:\n", "" ,1));
    double coy = Double.parseDouble(JOptionPane.showInputDialog(null, "Please enter the Y Coordinate:\n", "" ,1));

    qCities.enqueue(new City(strC, cox, coy));
    }
    length = qCities.length();
    }

    public City()
    {
    while(int i = 1; i <= qCities.length; i++)
    {
    double coxa, coya;
    double distance;

    distance = (coxa - coya);
    }
    }

    public void printCity()
    {
    while(!qCities.isEmpty)
    {
    aCity = (City)qCities.dequeue();
    aCity.Print();
    }
    }

    public void totalMiles()
    {
    if(qCities.isEmpty())
    {
    aCity = (City)qCities.dequeue();
    totalDistance += aCity.total;
    aCity.Print();


    totalMiles();
    }
    else

    JOptionPane.showMessageDialog(null,"The total distance is:/n" , totalDistance);

    }

    public void run()
    {
    while(true)
    {

    String msg = "Pleasechoose an option/n"+
    " 1 to enter city names/n"+
    " 2 to exit/n"+
    " Your chose: ";

    String thePick = JOptionPane.showInputDialog(null, msg, "" , 1);

    int choice = Integer.parseInt(thePick);

    switch(choice)
    {
    case 1:
    addCity();

    // getDistace();
    break;

    case 2:
    return;
    }
    }

    }


    }

  2. #2
    Join Date
    Jan 2006
    Posts
    605

    Re: JAVA need some help

    I think that you get a "cannot resolve symbol" pop-up because the compiler is not able to recognize something that you might have typed, compiler errors tell you exactly which symbols it does not recognize.

Similar Threads

  1. Replies: 4
    Last Post: 04-09-2013, 11:04 PM
  2. Setting Of Java to The Point At Manual Java
    By winni in forum Software Development
    Replies: 4
    Last Post: 10-01-2011, 10:05 PM
  3. Java Programming using Adventnet SNMP Java API
    By ROCKING_Suhas in forum Software Development
    Replies: 5
    Last Post: 17-07-2010, 06:52 AM
  4. Link List Example in Java Sample program in Java
    By trickson in forum Software Development
    Replies: 2
    Last Post: 04-08-2009, 08:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,419,229.43405 seconds with 17 queries