Lv 2693 points

nitneylion452

Favorite Answers33%
Answers78
  • Help with reading bits?

    I need some help reading bits and moving them to a linked list using a recursive function. I have no idea how to read the bits. Any help would be appreciated. Code below.

    1 AnswerProgramming & Design9 years ago
  • How do I read values from a text file?

    I have a text file with a series of data points (x,y) listed as shown:

    200 0

    250 25

    etc

    I need to read those numbers into a double linked list. What should I use to read those values from the file?

    2 AnswersProgramming & Design9 years ago
  • Computing average with a 2d array?

    package kinectintruderalarm;

    import java.awt.Color;

    public class Assignment01 {

    public static void main(String args[]) {

    Assignment01 asg01 = new Assignment01();

    }

    public Assignment01() {

    // Create an output frame

    KinectOutputLIGHT ko = new KinectOutputLIGHT();

    ko.depthXYZ.setViewParameters(45, 55, 1500);

    // mainloop: read data, analyze and display

    for (int i = 0; i < 70; i++) {

    // read data

    String filename = "DATA/DepthFile" + i + ".txt";

    int[][] data = KinectTCPClientLIGHT.readDepthFileTo2DArray(filename);

    // analyze

    double distance = computeAverageDistance(data);

    System.out.println(computeAverageDistance(data));

    if (distance < 2500.0) {

    KoDepthPanelLIGHT.backgroundColor = new Color(100, 0, 0);

    } else {

    KoDepthPanelLIGHT.backgroundColor = Color.BLACK;

    }

    // display

    ko.displayDepthXYZ(data);

    }

    }

    // This function has to be replaced by your solution!!!

    public double computeAverageDistance(int[][] data)

    {

    int sum = 0;

    for(int i = 0; i < data.length; i++)

    sum += data[i][i];

    double dist = (double) sum / (double) 3;

    return (dist);

    }

    }

    That's the class. What I'm dealing with is the method public double computeAverageDistance. I get an ArrayIndexOutOfBounds exception at index = 3, but the length of the array data[][] is ~50,000 points. Any ideas on how I can fix this?

    1 AnswerProgramming & Design9 years ago
  • How do I invoke a non-static method in the static method main in java?

    public static void main(String[] args)

    {

    ArrayList<Product> stock = new ArrayList<Product>();

    System.out.println("Welcome to JAVAmart stock management system. Please select an action from the menu.");

    System.out.println("1. Add a product to the stock.");

    System.out.println("2. Restock an item.");

    System.out.println("3. Sell an item.");

    System.out.println("4. Check the stock level of an item.");

    System.out.println("5. Check the details of an item.");

    System.out.println("6. Exit.");

    Scanner kb = new Scanner(System.in);

    int choice = kb.nextInt();

    if(choice == 1)

    {

    System.out.println("Please enter an ID, reorder threshold, and quantity.");

    int addId = kb.nextInt();

    int addThreshold = kb.nextInt();

    int addQuantity = kb.nextInt();

    Product item = new Product(addId, addThreshold, addQuantity);

    addProduct(item);

    }

    }

    I get an error saying that non-static method addProduct() cannot be referenced from a static context. Please help! This is due by midnight tonight!

    3 AnswersProgramming & Design9 years ago
  • Is a NEC Display NP115 Yes DLP Projector good for gaming?

    I am considering buying this projector for my 360 in my basement. Here are some specs:

    Contrast Ratio 2000:1

    Diagonal Image Size 300"

    Maximum Resolution 1600 x 1200

    Native Resolution 800 x 600

    Standard Mode Brightness 2500 lm

    Graphic Mode SVGA

    Minimum Projection Distance 47"

    Maximum Projection Distance 39.40 ft

    Native Aspect Ratio 4:3

    Vertical Keystone Correction -40°/+40°

    Minimum Lens Aperture F/2.41

    Maximum Lens Aperture F/2.55

    2 AnswersHome Theater1 decade ago
  • What is the Budget for the UNFCCC?

    I have a debate coming up and I need to know what the budget for the UNFCCC is so I can allot some of it toward helping underdeveloped nations meet their requirements for the soon-to-be Copenhagen Protocol. Please help.

    1 AnswerInternational Organizations1 decade ago
  • The Kyoto Protocol. Should China be bound?

    China is the most polluting nation in the world, but they use the argument that the USA and other industrialized nations had 200 years free of restriction and now it is China's turn to jump in to the industrial age. However, there will be no world if the climate continues to change like it is. What is your take on the matter?

    2 AnswersInternational Organizations1 decade ago
  • What Countries have recognized Kosovo?

    What are the countries that have recognized Kosovo as an independent nation?

    2 AnswersOther - Politics & Government1 decade ago
  • What are the isotopes of Aluminum?

    I'm doing a project due tomorrow and I need to know how many isotopes Aluminum has, what their mass numbers are, avg atomic masses, % abundances, half-lives, and uses. Please, help me?

    2 AnswersChemistry1 decade ago