Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Lv 1164 points

iverson_575

Favorite Answers9%
Answers22
  • Java read in text and then write to text file?

    I am trying to read in from a text file line by line and then if the line meets a certain condition I want to write that line to a different text file. Here is what I have so far.

    public static ArrayList<String> stringSplit(String inputString){

    if(inputString == null){

    ArrayList<String> empty = new ArrayList<String>();

    return empty;

    }

    ArrayList<String> array = new ArrayList<String>();

    String comma = ",";

    String[] line;

    line = inputString.split(comma);

    for(String s : line){

    array.add(s);

    }

    return array;

    }

    //Creates the text file to be written to

    File RFP = new File("RFP_Report.txt");

    PrintWriter out = new PrintWriter(RFP);

    Scanner inputFile = new Scanner(new FileInputStream("SalesIntake.txt"));

    while(inputFile.hasNextLine()){

    String line = inputFile.nextLine();

    ArrayList<String> order = stringSplit(line);

    int count = 0;

    if(order.get(3) == "0"){

    for(int i=0; i < order.size()-1; i++ ){

    out.print(order.get(i));

    if(count < 3){

    out.print(",");

    count++;

    }

    }

    }

    out.println();

    }

    out.close();

    So I want to read in from SalesIntake.txt line by line. The SalesIntake.txt has lines like:

    GHI,X,5,1000

    MNO,Y,10,3000

    JKL,Z,8,0

    Where GHI is the name of the company, X is the product, 5 is the quantity, and 1000 is the price the company is paying. Above I want to write to the RFP_Report file when the last number is 0 like (JKL,Z,8,0). So the RFP_Report will have only lines like JKL,Z,8,0

    1 AnswerProgramming & Design1 decade ago
  • Java Programming help?

    For one of my programming classes we had to make a program where it generated a random number between 1-100 and then the user has to guess. After every guess it will tell you if your input was lower, higher, or incorrect input then the random number. My professor just added on to the assignment where the program can accept 2-5 players playing at the same time. Then comparing the number of times it has taken each person to guess the correct random number. The person with the fewest guesses wins or possibly a tie. What would be the best way to keep track of multiple players guessing?

    Here's a sample of what it should look like:

    Sample output:

    How many players (2-5)? 2

    I’ve picked a random number between 1 and 100 for each player.

    Player 1 guess => 50

    Player 2 guess => 75

    Player 1 your guess is Too High!

    Player 2 your guess is Too Low!

    Player 1 guess => 25

    Player 2 guess => 99

    Player 1 your guess is Too Low!

    Player 2 your guess is Correct!

    Player 2 is the winner with 2 guesses to get the right answer.

    Thanks for playing!

    I just need help with how I am going to keep track of all the players. Thanks

    1 AnswerProgramming & Design1 decade ago
  • How do I stop a program in python?

    I want to be able to stop my program at a certain spot. For example

    I have some code here

    if something < something

    print something

    (then i want the program to stop and not continue on with the program

    some code here

    It's probably something really easy. I have tried searching the internet but I guess I do not know what it is called or I am searching completely wrong

    4 AnswersProgramming & Design1 decade ago
  • At what point did the late adopters get involved with Flickr?

    I am doing a research paper on Flickr. My question is At what point did the late adopters get involved with Flickr? I am having a hard time find the answer to this. What I was trying to do was get the statistics since Flickr was first started till 2009 and see where the last jump in hits per month was. Then once I knew a date I could search what happened to make those late adopters get involved. Does this sound like a good strategy or does anyone else have a better solution.

    Thanks

    2 AnswersPhotography1 decade ago
  • Anything I can do if external HD is taking forever to reformat?

    A few weeks back I was transferring a video file from my computer to my external HD. Something happened during the transfer and it seemed to be stuck transferring. I unplugged the external HD and when I plugged in my external HD again windows did not recognize the drive.

    My next step was to reformat the drive. I tried doing a quick reformat, but windows gave me an error message saying it couldn't reformat. So then I was stuck doing a regular reformat. As of right now almost 3pm eastern time, the reformat has been going for about 15 1/2 hours and is only at 19%.

    Obviously there is something wrong with the external HD. I have had this problem before, but with an internal HD. The way I fixed it was I had to do a error check of the drive then I was able to format fine. I can't do an error check on the external HD because it says that the drive is "Raw".

    Should I just leave the reformat going till it's done or is there a better solution to my problem?

    I am running Windows Vista Ultimate.

    3 AnswersAdd-ons1 decade ago
  • Need help starting Java program.?

    I am writing a java program where the user creates a file. Then the user can enter the names of video games they have. They also have the option to search for games they already have and be able to delete a name. (I am using the JOption class)

    Should I put the names in an array? I only have to put in 10 game names max.

    I am just a little confused on how to start this. If I could get some help on this like maybe a pseudo code or anything I would appreciate it very much.

    3 AnswersProgramming & Design1 decade ago
  • Displaying data in table with java?

    I am developing a program where the user enters a starting integer and an ending integer then in a table I print the staring integer to the ending integer sqrt(), cbrt(), exp().

    Should look something like this:

    say i enter 1 and 5

    Square root: 1 2 4 5

    Cube root: 6 8 9 0

    exp: 7 8 9 0

    doubles have to be formated to 2 decimal places. Heres what I have so far. I just don't know how to show Sqare Root, Cube Root, and exp only once with out repeating witht the number the user entered.

    while(s <= e)

    {

    System.out.print("Squre Root "+form.format(Math.sqrt(s)));

    System.out.print("Cube Root "+form.format(Math.cbrt(s)));

    System.out.print("Exp "+form.format(Math.exp(s)));

    s++;

    }

    I end up getting something like this:

    Square Root: 1.00 Square Root 1.41 Square Root 1.73

    Cube Root: 3.00 Cube Root 6.34 Cube Root 4.56

    Exp: 4.32 Exp: 2.34 Exp: 1.23

    1 AnswerProgramming & Design1 decade ago
  • Java string question?

    I am trying to put 2 strings with in the same dialog box. The program excepts an integer input from the user. After converting all the integers into 1 string it then shows 1 to the integer entered in reverse order on the same line. Then under that in the same dialog box I have to put it in reverse order but each integer on a separate line.

    while (w >= b)

    {

    result4 = result4 + w + " ";

    w--;

    }

    JOptionPane.showMessageDialog(null, result4);

    I can do the first part of reversing the order on the same line but I can't figure out how to keep it reversed just make it appear under it on separte lines.

    output would look like this:

    10 9 8 7 6 5 4 3 2 1

    10

    9

    8

    7

    6

    5

    4

    3

    2

    1

    2 AnswersProgramming & Design1 decade ago
  • How do police track a cell phone?

    I ask this because a friend was attacked, and robbed. The attacker(s) had taken his cell phone. Is there a way to track the cell phone assuming he didn't have any GPS services or anything like that? Also considering the police would track it so they would have any resource available. Is there there anything a person could do to modify the cell phone so it can't be tracked?

    Any knowlege on tracking cell phones would be appreciated.

    Thanks,

    4 AnswersLaw Enforcement & Police1 decade ago
  • Printing numbers 1 to 10 on one line using java?

    Using a while loop I need to print the numbers 1 to 10 on the same line separated by 1 space. It has to be displayed using a dialog box.

    This is the code I have for printing 1 to 10 on separate lines.

    int i = 1;

    String result = " ";

    while (i < 11)

    {

    result = result + i + "\n";

    i++;

    }

    JOptionPane.showMessageDialog(null,"\n" +result);

    2 AnswersProgramming & Design1 decade ago
  • VB, C, C++, Java programming with macs?

    I need to buy a new laptop. I did some research and the MacBook pro had the best hardware for the price, also macs are 2nd in reliability. http://www.xbitlabs.com/news/other/display/2006101... I used to have a PC which I used for gaming and programming. Can you use visual studio on macs? I have also heard about people installing windows on macs. How well does that work? Are there any compatibility issues or problems with doing that.

    1 AnswerLaptops & Notebooks1 decade ago
  • Need help with VB code?

    As a h/w assignment for school I am supposed to develope a loan application. The part I need help with is I have check boxes of different credit cards. If the user checks off Master Card then the program checks the text box next to it to see what the user put in for their balance. Then I have some if/then statements to see if the balance is above some number to see if they get a point. I just don't know how to interact the check boxes with their corresponding text boxes.

    2 AnswersProgramming & Design1 decade ago
  • Most reliable notebook manufacturer?

    I had a Dell 9600 and the. nVida 6800 Pro video card went to ****. I had the laptop for alittle over a year. I am looking to buy another laptop and I have up to about $2,500 or so to spend. I want to know what the most reliable laptop will be that will last me longer than a year.

    5 AnswersLaptops & Notebooks1 decade ago
  • How to make my games full screen?

    So when I go to play Diablo 2 on an older Dell Lattitude the game is in a little box in the center of the screen with a bunch of black surrounding it. I saw the exact same question posted by someone else and I tried changing the resolution. Is there anything else I can try to make it full screen?

    1 AnswerVideo & Online Games1 decade ago
  • How do I take a value from text boxes and display it as a label in visual basic.?

    I have to display a value as a label in visual basic. I have it setup where you enter values in text boxes. I have everything I need to get the answer I just don't know how to display the answer as a label.

    5 AnswersProgramming & Design1 decade ago