• I stayed up until about 1:00 am working on my code from yesterday. May someone please check it for me?

    INSTRUNCTIONS ~A 2D array is considered "magic" if the following are true: -The array is square (N rows and N columns) -The sums of each row, the sums of each column, and the sums of each diagonal are all equal. ~Complete the isMagic method so that it will determine whether a given array is magic. public class Challenge { public... show more
    INSTRUNCTIONS ~A 2D array is considered "magic" if the following are true: -The array is square (N rows and N columns) -The sums of each row, the sums of each column, and the sums of each diagonal are all equal. ~Complete the isMagic method so that it will determine whether a given array is magic. public class Challenge { public static boolean isMagicSquare(int[][] array) { boolean result = true; for (int row = 0; row < array.length; row++) { if (array[row].length != array.length) { result = false; } } if (result) { int sum = 0; for (int col = 0; col < array.length; col++) { sum += array[0][col]; } for (int row = 1; row < array.length; row++) { int newSum = 0; for (int col = 0; col < array[row].length; col++) { newSum += array[row][col]; } if (sum != newSum) { result = false; } } } return result; } }
    Programming & Design · 4 days ago
  • Can someone tell me if my java code is correct?

    The code is to produce the same number of rows and columns and sums of each row, the sums of each column, and the sums of each diagonal are all equal. CODE: public class Challenge { public static void[][] isMagic(){ int total = 0; for (int j = 0; j < size; ++j) total += square[row][j]; ... show more
    The code is to produce the same number of rows and columns and sums of each row, the sums of each column, and the sums of each diagonal are all equal. CODE: public class Challenge { public static void[][] isMagic(){ int total = 0; for (int j = 0; j < size; ++j) total += square[row][j]; return total; } int sumCol (int col) int mainDiagonal () { int total = 0; for (int i = 0; i < size; ++i) total += square[i][i]; return total; } }
    3 answers · Programming & Design · 4 days ago
  • Did i complete my java 2D array code correctly? im trying to return the sum of all the elements in the topmost row.?

    public class Practice2 { public static int sumRow(int[][] array, int row) { rowSum = rowSum + myArray[row][col]; for( row = 0; row++) System.out.println("Sum of row " + row + " is " + rowSum); } }
    public class Practice2 { public static int sumRow(int[][] array, int row) { rowSum = rowSum + myArray[row][col]; for( row = 0; row++) System.out.println("Sum of row " + row + " is " + rowSum); } }
    4 answers · Programming & Design · 3 weeks ago
  • I started working on my java code i recently posted and reduced the number of errors. Do the code look ok?

    public class ArrayPractice { public static String minVowels(String[] words) { String minvol = words[0]; for(int i = 1; i < words.length; i++){ if (isVowel (words [i]) == isVowel (minvol)) { minvol = words[i]; }else if (words[i].isVowel()== minvol.isVowel()){ ... show more
    public class ArrayPractice { public static String minVowels(String[] words) { String minvol = words[0]; for(int i = 1; i < words.length; i++){ if (isVowel (words [i]) == isVowel (minvol)) { minvol = words[i]; }else if (words[i].isVowel()== minvol.isVowel()){ if(words[i].length() < minvol.length()){ minvol = words[i]; } return minvol; } return minvol; } } public static boolean isVowel(String ch) { int count = 0; String str = ""; ch = ch.toLowerCase(); for(int i = 0; i < ch.length(); i++){ str = ch.substring(i,i+1); if(str.equals("a") || str.equals("e") || str.equals("i") ||str.equals("o") || str.equals("u")){ count ++; } } return count ; } }
    4 answers · Programming & Design · 4 weeks ago
  • Can someone help me with my java code?

    public class ArrayPractice { public static String minVowels(String[] words) { String minvol = words[0]; for(int i = 1; i< words.length; i++){ if(words[i].isVowel() < minvol.isVowel()){ minvol = words[i]; }else if (words[i].isVowel()== minvol.isVowel()){ ... show more
    public class ArrayPractice { public static String minVowels(String[] words) { String minvol = words[0]; for(int i = 1; i< words.length; i++){ if(words[i].isVowel() < minvol.isVowel()){ minvol = words[i]; }else if (words[i].isVowel()== minvol.isVowel()){ if(words[i].length() < minvol.length()){ minvol = words[i]; } return minvol; } return minvol; } } public static boolean isVowel(String ch) { int count = 0; string str = ""; ch = ch.toLowerCase(); for(int i = 0; i < ch.length(); i++){ str = ch.substring(i,i+1); if(str.equals("a") || str.equals("e") || str.equals("i") ||str.equals("o") || str.equals("u")){ count ++; } } return count; } }
    3 answers · Programming & Design · 4 weeks ago
  • Can someone help me to understand what is wrong with my java code? The website my work is on is saying the statement in all caps is wrong?

    public class ArrayPractice { public static String maxLength(String[] arr) { int largest = 0; for (String element : arr) { if (element.length() > largest) { } } RETURN LARGEST; } }
    public class ArrayPractice { public static String maxLength(String[] arr) { int largest = 0; for (String element : arr) { if (element.length() > largest) { } } RETURN LARGEST; } }
    2 answers · Programming & Design · 4 weeks ago
  • Can a Christian answer these 10 questions honestly?

    1. Can you make a moral judgment against rape or slavery using only scripture? 2. Would you sacrifice your child if god asked you to? 3. Is it acceptable to cherry pick the bible and only follow the parts you agree with? 4. How did animal X get from point Y to point Z after the great flood? 5. How did carnivorous dinosaurs supposedly eat plants... show more
    1. Can you make a moral judgment against rape or slavery using only scripture? 2. Would you sacrifice your child if god asked you to? 3. Is it acceptable to cherry pick the bible and only follow the parts you agree with? 4. How did animal X get from point Y to point Z after the great flood? 5. How did carnivorous dinosaurs supposedly eat plants before the biblical fall of man, when their teeth and digestive systems were not equipped to process a vegetarian diet? 6. Can god tell a lie? 7. Is observable physical evidence more important and valid than what the bible claims to be true? 8. Is there any amount of evidence that would change your views? 9. What physical proof is there that your particular god even exists? 10. Do you believe hell is a justifiable punishment for a simple lack of belief?
    4 answers · Religion & Spirituality · 4 weeks ago
  • Can someone help me to understand what is wrong with my code?

    public class ArrayPractice { public static String maxLength(String[] arr) { int largest = 0; for (String element : arr) { if (element.length > largest ) { element.length = largest; } } return largest; } }
    public class ArrayPractice { public static String maxLength(String[] arr) { int largest = 0; for (String element : arr) { if (element.length > largest ) { element.length = largest; } } return largest; } }
    3 answers · Programming & Design · 1 month ago
  • Can someone please explain how I would do this code in java?

    Complete the maxLength method so that given the array words, it will return the word with the largest length.
    Complete the maxLength method so that given the array words, it will return the word with the largest length.
    2 answers · Programming & Design · 1 month ago
  • Please help this is java?

    4 answers · Programming & Design · 1 month ago
  • Please help. this is java?

    Make a static method called reduce10 method by making it subtract 10 from every element of the int array nums. You may assume that the array will ALWAYS have 3 rows and 4 columns. The method does not have to return anything - you should be modifying the nums array that is passed via parameter.
    Make a static method called reduce10 method by making it subtract 10 from every element of the int array nums. You may assume that the array will ALWAYS have 3 rows and 4 columns. The method does not have to return anything - you should be modifying the nums array that is passed via parameter.
    2 answers · Programming & Design · 1 month ago
  • Can someone help me write this array in java please?

    1.The TestArray class should contain a single state variable, which is a String array of undetermined length. 2.The constructor for TestArray should first use User.numNames() to initialize the size of the array, then use User.getName() repeatedly to fill out the array. 3.Include a printFirstLetter method that prints the first letter of each String... show more
    1.The TestArray class should contain a single state variable, which is a String array of undetermined length. 2.The constructor for TestArray should first use User.numNames() to initialize the size of the array, then use User.getName() repeatedly to fill out the array. 3.Include a printFirstLetter method that prints the first letter of each String of the array on the same line, with no spaces in between.
    1 answer · Programming & Design · 2 months ago