EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
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...
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
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 prompts the user to enter nine integers and then store those nine integers in an array. Display the integers from first to last, and then display the integers from last to first. You do not have to sort them, just display the order entered and the reverse order entered. (In JAVA)
In java, please read the text file as array. Then, replace the null with 0 and calculate the sum of the new students in ABC University.Example of text file: (university,year,total_students,new_students,new_staff,ABC, 2000, 3457, , ,ABC, 2001, 3675,218, ,EFG, 2000, 2389,602, ,EFG, 2001, 2785,396, 65,)
Knowledge Booster
Similar questions
- 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.arrow_forwardWrite 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. ***can you provide comments explaining your methods? Thank you for all of your help ^_^arrow_forwardWrite a java application that stores nine integers in an array. Display the integers from first tolast, and then display the integers from last to first.arrow_forward
- Write a java application which initializes an array with ten random integers between 1 and 6. Write two methods: 1. arraySwap: this method should accept an integer array and swap the first and the last item. 2. findMinimum: this method should accept the array and return the minimum value of that array You should comment and follow javaDoc for both methods. Your main method should test each of these methods.arrow_forwardWrite a program that allows a user to enter any desired amount of student grades, stores the grades in an array, then prints the results to the screen. Then, find the average of the grades.arrow_forwardWrite a Java application and use a Two dimensional array to store five Dutch, French and Italian translated words. Use a single array to store the English words.Your program must:Q.2.1Contain a single array to contain the following five English words and a Two dimensional array to store the following Dutch, French and Italian translated words.ENGLISH WORD skyrunstudymusic dogDUTCH WORD hemelrennenstudiemuziek hondFRENCH WORD cielcouriretudemusique chienITALIAN WORD cielocorrerestudiamusica cane Print out each English word with the translated Dutch, French and Italian wordarrow_forward
- Another way to write this java applacation? Write an application that inputs five numbers, each between 10 and 100, inclusive. As each number is read, display it only if it’s not a duplicate of a number already read. Provide for the “worst case,” in which all five numbers are different. Use the smallest possible array to solve this problem. Display the complete set of unique values input after the user enters each new value. Here is the code I have I just want to see another way it could be written. import java.util.Scanner; public class DuplicateElimination { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int arr[] = new int[5]; int size = 0, n; for(int i = 0;i<5;i++){ System.out.print("Enter an integer between 10 and 100:"); n = scanner.nextInt(); if(size==0 || elemanVarmı(arr,size,n)){ System.out.println("This is the first time "+n+" has been entered");…arrow_forwardWrite an application containing three parallel arrays that hold 10 elements each. The first array hold four-digit student ID numbers, the second array holds first names, and the third array holds the students’ grade point averages. Use dialog boxes to accept a student ID number and display the student’s first name and grade point average. If a match is not found, display an error message that includes the invalid ID number and allow the user to search for a new ID number. java programarrow_forwardwrite a (GUI) application that asks a user how many integers to be entered, then stores the integers in an array. Allow the user to enter all or a portion of the total integers. Display the integers from first to last, and then display the integers from last to first. Display the minimum and maximum numbers as well as the total and average of the numbers.arrow_forward
- You are give an array which contains the following integers : 9, 10, 12, 15, 7, 2, 1, 16, 18, 5, 6. Write a java program that will give you the product of this arrayarrow_forwardWrite a Java application for a grade book using arrays: Create an array to store 20 test grades, random numbers between 0-100, inclusive. Print these 20 grades Calculate and print the average grade Calculate and print the highest and lowest gradesarrow_forwardCreate an array of objects of the Person class, of size 4. Create three objects of the Person class, with values, and assign the objects to the array. Loop through the array and print the name, job, and email of all Personobjects. (using the Netbeans application (Java)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage