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 2357 points

Aaron

Favorite Answers22%
Answers36
  • Any body know title of this book?

    Here are parts i remember: a guy walking at night sees a guy on a roof, and the same guy over on the ground, he figures he is messing with people using his twin brother. Meets stranger, sees him regularly, he chews every bite as if it were each a meal of its own, makes him eat slower. Eating something out of a bowl and finishes it quickly realizing he didnt appreciate it. Has a dream starting with him as a kid kicking clothes under his bed, of his entire life but if he never met the roof guy. Finds in mailbox from the stranger that says roof secrets or similar. Cover is like a guy half inisible with a bag next to a gas station? Please help. :)

    1 AnswerBooks & Authors8 years ago
  • Anyone familiar with this field of java?

    There are a few errors, one is that I need the variable "inputs" to be recognized outside of the for loop, it is because it was created inside the for loop, I was wondering if there was a way to go around that or a different approach I could try. Also, there is a minor issue with the char variables at the end. They do not like to be in if statements and be treated like Strings. How do you use char's in if statements like the way I need to?

    package javaapplication63;

    import javax.swing.JComponent;

    import javax.swing.JLabel;

    import javax.swing.JOptionPane;

    import javax.swing.JTextField;

    public class JavaApplication63 {

    public static void main(String[] args) {

    int numStudents = Integer.parseInt(JOptionPane.showInputDialog

    (null, "Create your class, How many people are in your class?"));

    //lets you chose how big your array is or your "class(like in school)"

    String[] students = new String[numStudents];

    //creates array that the students in the class will be in

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

    students[i] = JOptionPane.showInputDialog

    ("Now enter the names of your students. "

    + "Student #" + (i + 1) + ":");

    }

    //lets you input the names of the students in the class

    JTextField[] nameBox = new JTextField[numStudents];

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

    nameBox[i] = new JTextField();

    final JComponent[] inputs = new JComponent[] {

    new JLabel(students[i]),

    nameBox[i],

    };

    }

    JOptionPane.showMessageDialog(null, inputs, "A-Absent, T-Tardy, "

    + "E-Excused, nothing-on time", JOptionPane.PLAIN_MESSAGE);

    //creates a pop up dialog box with as many places to type in

    //as you have students, and has the name of each student next

    //to the place to type. This means that you should be able to

    //write an A T or E next to each students name.

    int howManyAbsent = 0;

    int howManyTardy = 0;

    int howManyExcused = 0;

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

    if(nameBox[i].getText().equalsIgnoreCase('A')){

    howManyAbsent = howManyAbsent + 1;

    }

    else if(nameBox[i].getText().equalsIgnoreCase('T')){

    howManyTardy = howManyTardy + 1;

    }

    else if(nameBox[i].getText().equalsIgnoreCase('E')){

    howManyExcused = howManyExcused + 1;

    }

    }

    //goes through the list of A's, T's, E's, and Blanks,

    //and for each one, adds 1 to a corresponding variable

    JOptionPane.showMessageDialog

    (null, "# of Absent Students: " + howManyAbsent

    + "# of Tardy Students: " + howManyTardy

    + "# of Excused Students: " + howManyExcused);

    //prints out a page with the number of each student who

    //was not on time.

    }

    }

    1 AnswerProgramming & Design8 years ago
  • anyone familiar with this field of java?

    The problem is that the print statement JOptionPane does not like to recognize that the word input exists, because it was initiated inside of the for loop. Think you can help? it is not finished yet, in case you are wondering. But this is everything that I have so far.

    package javaapplication63;

    import javax.swing.JComponent;

    import javax.swing.JLabel;

    import javax.swing.JOptionPane;

    import javax.swing.JTextField;

    public class JavaApplication63 {

    public static void main(String[] args) {

    int numStudents = Integer.parseInt(JOptionPane.showInputDialog

    (null, "Create your class, How many people are in your class?"));

    String[] students = new String[numStudents];

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

    students[i] = JOptionPane.showInputDialog

    ("Now enter the names of your students. "

    + "Student #" + (i + 1) + ":");

    }

    JTextField[] nameBox = new JTextField[numStudents];

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

    nameBox[i] = new JTextField();

    final JComponent[] inputs = new JComponent[] {

    new JLabel(students[i]),

    nameBox[i],

    };

    }

    JOptionPane.showMessageDialog(null, inputs, "A-Absent, T-Tardy, "

    // problem = inputs

    + "E-Excused, nothing-on time", JOptionPane.PLAIN_MESSAGE);

    }

    }

    2 AnswersProgramming & Design8 years ago
  • anyone know whats wrong with this java code?

    package firstnprimenumbers;

    import java.util.Arrays;

    import javax.swing.JOptionPane;

    public class FirstNPrimeNumbers {

    public static void main(String[] args) {

    int[] array = new int[100000];

    for (int z = 1; z < array.length; z++){

    array[z-1] = z;

    }

    int NPN = Integer.parseInt

    (JOptionPane.showInputDialog(null, "How Many Prime Numbers Do You Want?"));

    int[] finalArray = new int[NPN];

    for(int i = 1; i <= array.length; i++){

    for(int x = 1; x <= array.length; x++){

    for (int z = 1; z < NPN; z++){

    if(finalArray[z] == 0){

    if((i % x) > 0){

    finalArray[z] = i;

    }

    break;

    }

    }

    }

    }

    JOptionPane.showInputDialog(null, Arrays.toString(finalArray));

    }

    }

    1 AnswerProgramming & Design8 years ago
  • anyone willing to look over this code (java)?

    My friend asked me if I knew how to sort an array, so I used the sort method, but he wasn't impressed. this is my attempt with loops, and you get to chose the number of numbers in the array as well. (just because). anyone know whats wrong? p.s. it will do everything up to finding the highest number, and that part is tested as well, so the problem is most likely the part that is supposed to sort the array, which is that big nasty pile of four loops and if statements.

    package inorder.without.cheats;

    import java.util.Arrays;

    import javax.swing.JOptionPane;

    public class InOrderWithOutCheats {

    public static void main(String[] args) {

    int howManyNumbers = Integer.parseInt

    (JOptionPane.showInputDialog

    (null, "how many numbers would you like to chose?"));

    //gets number of numbers, stores number in "howManyNumbers"

    if (howManyNumbers <= 0){JOptionPane.showMessageDialog

    (null, "You Must Enter A Positive Number Greater "

    + "Than 0!", "Hey!", JOptionPane.ERROR_MESSAGE);

    }

    // prevents "howManyNumbers" from being <= 0

    int[] array = new int[howManyNumbers];

    int i = 1;

    while (i <= howManyNumbers){

    int choseNumber = Integer.parseInt

    (JOptionPane.showInputDialog

    (null, "Number #" + i));

    i = i -1;

    array[i] = choseNumber;

    i = i + 2;

    }

    // assigns the chosen numbers to array "array"

    int largest = array[0];

    for(int z = 0; z < array.length; z++){

    if(array[z] > largest){

    largest = array[z];

    }

    }

    // finds the largest number in "array" and puts it in "largest"

    int[] array2 = new int[array.length];

    for (int k = 0; k <= largest; k++){

    for (int a = 0; a <= array.length; a++){

    if (k == array[a]){

    for (int b = 0; b < array.length; b++){

    if (b == 0){

    k = array2[b];

    }

    }

    }

    }

    }

    /*

    * wrote this bit myself, it would be nice if it went through the array

    * and re arranged them numerically into "array2"

    */

    JOptionPane.showMessageDialog (null, Arrays.toString(array2));

    /*

    * and finnaly, this should give you the numbers you first entered,

    * but in order from least to greatest.

    */

    }

    }

    2 AnswersProgramming & Design9 years ago
  • so, I have a problem with this java code?

    It should arrange a set of numbers from least to greatest. But it doesn't. And I don't know why. see what you can do, I added comments to make it easier to figure out what is happening. When I run it in NetBeans, it asks for the number of numbers, and even asks for the specific numbers, but then it errors, so I suppose the problem could be anywhere from the finding of the highest number to the end. Thanks in advance!

    package inorder.without.cheats;

    import javax.swing.JOptionPane;

    public class InOrderWithOutCheats {

    public static void main(String[] args) {

    int howManyNumbers = Integer.parseInt (JOptionPane.showInputDialog

    (null, "how many numbers would you like to chose?"));

    // gets number of numbers, stores number in "howManyNumbers"

    if (howManyNumbers <= 0){JOptionPane.showMessageDialog

    (null, "You Must Enter A Positive Number Greater "

    + "Than 0!", "Hey!", JOptionPane.ERROR_MESSAGE);

    }

    // prevents "howManyNumbers" from being <= 0

    int[] array = new int[howManyNumbers];

    int i = 1;

    while (i <= howManyNumbers){

    int choseNumber = Integer.parseInt

    (JOptionPane.showInputDialog (null, "Number #" + i));

    i = i -1;

    array[i] = choseNumber;

    i = i + 2;

    }

    // pretty efficiantely assigns the chosen numbers to array "array"

    int largest = array[0];

    for(int z = 0; z < array.length; z++){

    if(array[z] > largest){

    largest = array[z];

    }

    }

    /*

    * I got this bit off the internet, it supposebly gets

    * the highest value in the array, and puts it in "largest"

    */

    int[] array2 = new int[array.length];

    for (int k = 0; k <= largest; k++){

    for (int a = 0; a <= array.length; a++){

    if (k == array[a]){

    for (int b = 0; b < array.length; b++){

    if (b == 0){

    k = array2[b];

    }

    }

    }

    }

    }

    /*

    * wrote this bit myself, it would be nice if it went through the array

    * and re arranged them numerically into "array2"

    */

    for (int c = 0; c < array2.length; c++){

    JOptionPane.showMessageDialog (null, array2[c]);

    }

    /*

    * and finnaly, this should give you the numbers you first entered,

    * but in order from least to greatest.

    * it would be nice if it would give them to you in a list,

    * but that is for after I fix the current problem.

    */

    }

    }

    3 AnswersProgramming & Design9 years ago
  • any ideas about this java code?

    it is supposed to ask how many numbers you'd like, which it does, then have you input specific numbers, the amount you chose, then tell you the first two numbers you chose, it has trouble assigning the integers to the array. any ideas?

    package inorder.without.cheats;

    import javax.swing.JOptionPane;

    public class InOrderWithOutCheats {

    public static void main(String[] args) {

    int howManyNumbers = Integer.parseInt (JOptionPane.showInputDialog

    (null, "how many numbers would you like to chose?"));

    //gets number of numbers, stores number in howManyNumbers

    if (howManyNumbers <= 0){

    JOptionPane.showMessageDialog

    (null, "You Must Enter A Positive Number Greater "

    + "Than 0!", "Hey!", JOptionPane.ERROR_MESSAGE);

    }

    //prevents number from being <= 0

    int[] array = new int[howManyNumbers];

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

    int choseNumber = Integer.parseInt

    (JOptionPane.showInputDialog

    (null, "Number #" + i));

    array[i] = choseNumber;

    }

    /*supposed to ask for each number, the amount you chose, and assign them to an array*/

    JOptionPane.showMessageDialog

    (null, "number 1: " + array[0] + " number 2: " + array[1]);

    //checks if it actually assigned them correctly, which it doesn't.

    }

    }

    2 AnswersProgramming & Design9 years ago
  • (beginner) what's wrong with this java code?

    package inorder.without.cheats;

    import javax.swing.JOptionPane;

    //imports what is needed for the dialog box (JOptionPane)

    public class InOrderWithOutCheats {

    public static void main(String[] args) {

    int howManyNumbers = Integer.parseInt (JOptionPane.showInputDialog

    (null, "how many numbers would you like to chose?"));

    /*saves input to the question "how many numbers would you like to chose?" into the variable howManyNumbers*/

    if (howManyNumbers <= 0){

    JOptionPane.showMessageDialog

    (null, "You Must Enter A Positive Number Greater "

    + "Than 0!", "Hey!", JOptionPane.ERROR_MESSAGE);

    }

    /*makes sure the inputed number of numbers in the array is a positive number greater than 0*/

    int[] array = new int[howManyNumbers];

    for (int i = 1; i <= howManyNumbers; i++){

    int choseNumber = Integer.parseInt

    (JOptionPane.showInputDialog

    (null, "Number #" + i));

    array[i] = choseNumber;

    }

    /*assigns (or tries to at least) the inputed numbers to the question "Number # 1" "Number # 2"... to the array array*/

    JOptionPane.showMessageDialog

    (null, "number 1: " + array[0] + " number 2: " + array[1]);

    /*confirms that it actually did what it is supposed to by listing off two of the numbers that were (supposed to be) assigned to the array. and fails*/

    Eventually it should put the numbers in an array in order with out the use of the "sort" shortcut.

    But for now not even this will do what i want, i just want this bit of code to ask how many numbers you would like in an array, ask what numbers are actually are in this array, then assign the chosen numbers to an array, and then just to check if it works, display the first two numbers. think you can help?

    1 AnswerProgramming & Design9 years ago
  • why does this java statement not work?

    String a = JOptionPane.showInputDialog ("a ");

    String b = JOptionPane.showInputDialog ("b ");

    String c = JOptionPane.showInputDialog ("c ");

    double rt = Math.sqrt( b^2 - 4 (a) (c) );

    int quadratic1 = -b + rt / 2a;

    int quadratic2 = -b - rt / 2a;

    JOptionPane.showMessageDialog ("answere one = " + quadratic1

    + " answere two = " + quadratic2);

    5 AnswersProgramming & Design9 years ago
  • netbeans java code says "empty statement after 'for'"?

    package yeah;

    public class Yeah {

    public static void main(String[] args) {

    int i;

    for(i = 1; i<10; i++);

    System.out.println (i);

    }}

    3 AnswersProgramming & Design9 years ago
  • what is wrong with this java statment?

    int grade=96;{

    if (grade<100 && grade>90)

    System.out.println("A");

    if (grade<90 && >80)

    System.out.println ("B");

    }

    6 AnswersProgramming & Design9 years ago