Write a complete Java
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Java: Introduction to Problem Solving and Programming
Additional Engineering Textbook Solutions
Starting Out with Python (4th Edition)
Starting Out with C++: Early Objects (9th Edition)
C How to Program (8th Edition)
Starting Out with Python (3rd Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- Write a program in Java that reads integers, one per line, and displays their sum. Also, display all the numbers read, each with an annotation giving its percentage contribution to the sum. Use a method that takes the entire array as one argument and returns the sum of the numbers in the array. (Hint: Ask the user for the number of integers to be entered, create an array of that length, and then fill the array with the integers read.arrow_forwardFOR JAVA Write a method that takes a one dimensional integer array and an integer, and returns the index of the integer in the array. If the integer is not in the array, your program must return -1. If there are multiple occurrences of that number, your program must return the smallest index.arrow_forwardWrite a Java program that expands a given binomial (x + y)^n, where integer n is user input. To do the work of the binomial expression, first create a method that accepts n as a parameter and then returns an array holding the coefficients needed for the binomial expansion using the Pascal’s Triangle method. Create a 2nd method which takes the array holding the coefficients as a parameter and prints the appropriate binomial expansion. For example, if n = 5 is entered by the user, the method calculating the coefficients should return {1,5,10,10,5,1} and the method that prints the expansion should print the following: (x + y)^5 = x^5 + 5x^4y + 10x^3y^2 + 10x^2y^3 + 5xy^4 + y^5 Your main method should use an appropriate loop for repeated inputs and automatically call the methods to calculate the coefficients and print the binomial expansion. There isn’t a need for a menu although you should ask the user if they want to quit or continue after their binomial expansion is printed each time.…arrow_forward
- Write a Java program that creates an array of integers with length 5 and fills it with the number 1 through 5 then loop through the array and print out each elementarrow_forwardFOR JAVA // Question is the first one, try to solve it by using the second question. Repeat the second question, but if there are multiple occurrences of the number, your program must return the largest index instead of the small- est. Write a method that takes a one dimensional integer array and an integer, and returns the index of the integer in the array. If the integer is not in the array, your program must return -1. If there are multiple occurrences of that number, your program must return the smallest index.arrow_forwardWrite a program in JAVA to input the number of elements in an array, also input the values in the array from the console. Replace all those elements which are even and greater than 5, with -99. Print the final array. Constraints: The array should initially not contain -99. The value of the number of elements should not be greater than 50.arrow_forward
- Write a complete java program called Transforming. This program will read ten integer numbers from the console and store them in an array. Then it will transform the array (update the array elements) by multiplying each element in the array by 3. Finally, it will printout the array elementsarrow_forwardWrite the Java method averageOfDoubles that is passed an array of double values, and returns the average of the array values.You can assume the array length is a positive integer.arrow_forwardwrite a program in java that creates an array of size 30 and type int, allows user to enter the values of all 30 elements and finds the sum of all 30 elementsarrow_forward
- How to write a program in java that ask the user to input an int size value into a 2d array, then output a table of random 0 and 1 of that size (table must be a perfect square), then output the fraction of your array that is ones and the fraction that is zeros, then output the sum for each row, the sum of colunms and which row and colunm have the largest sum, then determine if the largest row sum is greater than the largest column sum or vice versa, then output the sum of the diagonal(the diagonal starting at location [0][0] and going down to [N-1][N-1] for an array of size N) and determine if the diagonal sum is greater or equal to the largest row sum and greater than or equal to the largest column sum? output should look similar to screen shotarrow_forwardWrite a Java Program that allows the user to enter an arbitrary number of integer grades from the keyboard. Each grade should be added to an ArrayList called grades. Stop inputting grades when -1 is entered. The program should then iterate through the ArrayList, calculate the average grade, and output it along with the minimum and the maximum grade value.arrow_forwardWrite a java program to swap the first and the last elements of the array without creating a new array. The array may have any length.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education