Question

Write an application that stores the following nine integers in an array: 10, 15, 19, 23,...

Write an application that stores the following nine integers in an array: 10, 15, 19, 23, 26, 29, 31, 34, 38. Display the integers from first to last, and then display the integers from last to first.

-----------------------------------------------

public class NineInts {

    public static void main (String args[]) {

        // Write your code here

    }

}



------------------------

Please use JAVA

Homework Answers

Answer #1
public class NineInts {

    public static void main(String args[]) {
        int[] numbers = {10, 15, 19, 23, 26, 29, 31, 34, 38};
        for (int i = 0; i < numbers.length; i++) {
            System.out.print(numbers[i] + " ");
        }
        System.out.println();
        for (int i = 0; i < numbers.length; i++) {
            System.out.print(numbers[numbers.length - i - 1] + " ");
        }
        System.out.println();
    }
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write an application that asks a user to enter an integer. Display a statement that indicates...
Write an application that asks a user to enter an integer. Display a statement that indicates whether the integer is even or odd. ------------------------------------------ import java.util.Scanner; class EvenOdd {     public static void main(String[] args) {         // Write your code here     }     public static boolean isEven(int number) {     } }
Create an application to accept data for an array of five CertOfDeposit objects, and then display...
Create an application to accept data for an array of five CertOfDeposit objects, and then display the data. Use these classes and this code template to solve the problem: import java.time.*; public class CertOfDeposit {     private String certNum;     private String lastName;     private double balance;     private LocalDate issueDate;     private LocalDate maturityDate;     public CertOfDeposit(String num, String name, double bal, LocalDate issue) {     }     public void setCertNum(String n) {     }     public void setName(String name) {     }     public void setBalance(double bal) {     }     public...
Given an array of integers return the sum of the values stored in the first and...
Given an array of integers return the sum of the values stored in the first and last index of the array. The array will have at least 2 elements in it --------------------------------------- public class Class1 { public static int endSum(int[] values) {     //Enter code here } }
/* *Your name *Date * *Explanation of Program *-Modifying the first program * - print,printf, escape...
/* *Your name *Date * *Explanation of Program *-Modifying the first program * - print,printf, escape values, arithmetic operators */ public class Welcome1 { //main method begins execution f Java application public static void main (String [] args) { System.out.println("Welcome to Java Programming"); }//end method mai }//end class Welcome1 /* Output copied from display/message windowo * ----jGRASP exec: java Welcome1 *Welcom to Java Programming * *----jGRASP: operation complete. */ in JAVA Please edit this program in Java and update it
Java : Modify the selection sort algorithm to sort an array of integers in descending order....
Java : Modify the selection sort algorithm to sort an array of integers in descending order. describe how the skills you have gained could be applied in the field. Please don't use an already answered solution from chegg. I've unfortunately had that happen at many occasion ....... ........ sec01/SelectionSortDemo.java import java.util.Arrays; /** This program demonstrates the selection sort algorithm by sorting an array that is filled with random numbers. */ public class SelectionSortDemo { public static void main(String[] args) {...
Write a for loop that prints: 1 2 ... userNum Ex: userNum = 4 prints: 1...
Write a for loop that prints: 1 2 ... userNum Ex: userNum = 4 prints: 1 2 3 4 import java.util.Scanner; public class ForLoops { public static void main (String [] args) { int userNum; int i; Scanner input = new Scanner(System.in); userNum = input.nextInt(); for (/* Your code goes here */) { System.out.print(i + " "); } } } Need to fill out the "for" solved in JAVA
Write a loop that sets each array element to the sum of itself and the next...
Write a loop that sets each array element to the sum of itself and the next element, except for the last element which stays the same. Be careful not to index beyond the last element. Ex: Initial Scores: 10, 20, 30, 40 Scores after loop: 30, 50, 70, 40 Import. java.util.Scanner; public class StudentScores { public static void main (String [] args){ Scanner scnr = new Scanner (System.in); final int SCORES_SIZE = 4; int [] bonusScores = new int[SCORES_SIZE]; int...
Please let me know what programs are used to make the code and also a description...
Please let me know what programs are used to make the code and also a description of how to do this please! Write a Java program to print the sum (addition), multiplication, subtraction, and division of two numbers. Start your code by copying/pasting this information into an editor like notepad, notepad++, or IDLE: public class Main { public static void main(String[] args) { // Write your code here } } Sample input: Input first number: 125 Input second number: 24...
(This is for Java) For this I need to make a loop that will sum the...
(This is for Java) For this I need to make a loop that will sum the numbers from 3 to 22 public class Practice25 {    public static void main (String [] args) {            int sum = 0;           //The loop will go here      sum += i;     System.out.println ("Sum from 3 to 22 is: " + sum);    } }
In JAVA: Write a program that reads an integer, a list of words, and a character....
In JAVA: Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. Assume at least one word in the list will contain the given character. Assume that the list of words will always contain fewer than 20 words. Ex: If the input is: 4 hello zoo sleep drizzle...