EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
Expert Solution & Answer
Book Icon
Chapter 8, Problem 1PE

Explanation of Solution

Program:

File name: “NineInts.java

//Import necessary header files

import java.util.Scanner;

//Define a class named NineInts

public class NineInts

{

    //Define main method

    public static void main(String[] args)

    {

        //Create an object for Scanner class

        Scanner sc= new Scanner(System.in);

        //Declare an array of integers

        int[] num = new int[9];

        //Prompt the user to enter nine integers

        System.out.print("Enter nine integers: ");

        for(int i=0;i<9;i++)

        {

    num[i]=sc.nextInt();

        }

        //Print the numbers from first to last

        System...

Blurred answer
Students have asked these similar questions
Create an application that contains an enumeration (enum) that represents the days of the week.  Display a list of the days, then prompt the user for a day. Display business hours for the chosen day.  Create your own business hours stored in an array; however, every day of the week should have different hours.  Although companies do not normally have different business hours every day of the week, programming your code with this difference will help in finding and fixing coding errors. java program
Write an application that stores nine integers in an array. Display the integers from first tolast, and then display the integers from last to first.
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.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT