Create a program whose Main() method declares an array of 10 integers. Call a method to interactively fill the array with any number of values up to 10 or until a sentinel value is entered. If an entry is not an integer, re-prompt the user. Call a second method that accepts out parameters for the highest value in the array, lowest value in the array, sum of the values in the array, and arithmetic average. In the Main() method, display all the statistics.
Q: A method named findElement that takes a double number and an array of double numbers as parameters…
A: *As no Programming language is mentioned, writing this program in Java. public class Main…
Q: Needs to be written for Java and in one program: Write a program that asks the user to input two…
A: Objective: This program creates an array within a given range and returns the array to the main…
Q: Write (define) a public static method named getIndexOfMax, that takes an Array of int as an argument…
A: public class Main{ public static void main(String[] args) { int[] myArray = {1, 22, 333, 400,…
Q: In the space below, write the method: public int centerof 3Count (int[][] arr) This method will…
A: The text of the code with self explanatory embedded comments is given below: import java.util.*;…
Q: Define a method named getWordFrequency that takes an array of strings, the size of the array, and a…
A: ANSWER:-
Q: A method int [] makeRandomArray(int size ,int a , int b) that makes and returns an array with…
A: hi there in the code as mentioned, above i have used all four methods int[] make randomArray(): To…
Q: Write a program which does the following: 1. Create a class with the main() method. 2. Take a string…
A: note:- length() and indexOf() both returns indexes in numeric, you must have to use charAt() to…
Q: Write a method that takes an integer value n as a parameter. Inside the method, you should create an…
A: Solution Given that Write a method that takes input n as a parameter. inside this method, it…
Q: Write a method that takes three inputs. The first input is a 2d array of integers, the second and…
A: Given : Write a method that takes three inputs. The first input is a 2d array of integers, the…
Q: We need to develop a game that allows two players to throw a dice ten times and the player who gets…
A: Given:
Q: Write a method (use any valid name) to accomplish the following task: To receive an integer array as…
A: Algorithm: Step-1: Start Step-2: Define a method with passing one parameter or argument, that is…
Q: Write a class ArrayMethods, where the main method asks the user to enter the number of inputs and…
A: import java.util.Scanner;class Main{public static void printArray(int[] myList){// loop through…
Q: Write a Java program to generate random integer values between 5 and 20 to fill a single dimensional…
A: import java.util.Random;public class Main{ public static void main(String[] args) { Random random =…
Q: Write a method that takes an argument representing an array, orig,and returns a new array that is…
A: Create a new array which is having the excess length of half Then, copy the values and the remaining…
Q: Write (define) a public static method named countGreaterThan, that takes an array of int, and an int…
A: public class Main{ public static int countGreaterThan(int arr[], int value) { int count…
Q: write a method called insert that inserts an element into an integer array. It should take 3…
A: print array method is also implemented for printing the numbers in array
Q: Given two intervals (a1, b1) and (a2, b2) on the real number line, write a method overlap to…
A: /* Method overlap */ #include<iostream>using namespace std;int overlap(float a[2], float b[2])…
Q: An element in the array is a peak (max or min) if the elements before and after that element are…
A: Program approach: Create a class named displayPeak. Declare a nmethod named initValues() for…
Q: This is the code that I am unsure where to fully start -
A: Approach For loop is used to iterate over Purchase array length. In the loop, the user is asked to…
Q: Given the following multidimensional array, complete the method below so that it will access the…
A: The missing code is given below along with the explanation:
Q: Write a program that calls these two methods as described below printPattern (int a) – A void method…
A: NOTE: Since the language has not been mentioned I have used Python for this question. Also if you…
Q: Consider a 2D int-array that contains the brightness values of the pixels in an image. Write a…
A: please do support for my efforts, thanks! answer: #include <bits/stdc++.h>using namespace…
Q: Create a program whose Main() method declares an array of 10 integers. Call a method to…
A: Here I have created a function named fillArray(). In this function, I have taken input from the user…
Q: Write a program with a main() method that asks the user to input an integer array of 10 elements.…
A: - The question is to code the provided program with the described functions.
Q: Write a class ArrayMethods, where the main method asks the user to enter the number of inputs and…
A: pseudocode for program- 1. take number of items input from user(i.e. n) 2. input the array by…
Q: Write a class ArrayMethods, where the main method asks the user to enter the number of inputs and…
A: import java.io.*;public class ArrayMethods { public static int[] copyArray(int myList[]) { int…
Q: Write a program called Range_array.java that has a method with one integer array and two integers…
A: import java.util.*;public class Main{ public static int [] delete_range(int [] arr,int start,int…
Q: Write a method that takes an integer array as its parameter and sorts the contents of the array in…
A: import java.util.Scanner;import java.util.Random;public class zxc{ public static void main…
Q: A method named addElementTolndex that takes an array of double numbers, a double number to be added…
A: The array indices will be from 0 and if you want to store at ending of array then you need to pass…
Q: Write a static method calculateVariance(), that gets an integer n as parameter. Ask the user to…
A: Start Input n Input array Calculate Average Calculate Mean Print Mean Print Variance Stop
Q: In this lab assignment you need to implement the method named middleValue, in a program named…
A: Actually, array is a collection of array.
Q: I have to write a method that removes the middle element if the array length is odd or the middle…
A: Step 1: Accept Array from User/Declare and initialized array Step 2: Check the size of array Step 3:…
Q: Write a method that takes a two-dimensional array of type int and returns no value. The method…
A: The problem is based on the basics of functions and loops in java programming language.
Q: my problem is I want to add tho the method an error message in case the user inter a wrong ID
A: public static void main(String args[]) { //adding try block where error can occur try() {…
Q: Write (define) a public static method named getAllButLast, that takes an Array of int as an argument…
A: public class Main{ public static void main(String[] args) { int[] myArray = {1, 22, 333, 400,…
Q: In ArrayUtility class, create a public static method equals that receives two arrays of int's and…
A: class ArrayUtility: // class ArrayUtilitypublic class ArrayUtility{/// function toString return as…
Q: Write a program that stores a phrase as an array of words, and then prints it backward. The main…
A: Programming language is missing in the question. So we will answer this program in Java. If you want…
Q: Write a program to test your implementation by reading data related to 50 Car objects and store them…
A: **THIS CODE IS WRITTEN IN JAVA SINCE NO PROGRAMMING LANGUAGE WAS MENTIONED ** READ THE COMMENTS…
Q: Given the code snippet below, the method "getSmallest Value" is meant to return the smallest value…
A: int smallest= 0; It is wrong because negative values are smaller than 0. So assign first element of…
Q: Create a program whose Main() method declares an array of 10 integers. Call a method to…
A: Question given: A program which take input in an integer array of size 10. Find out array's all…
Q: Write a complete Java program named FindAverage that contains the following: A main method asks…
A: Given: Write a complete Java program named FindAverage that contains the following: A main method…
Q: Write a complete Java program that provides two methods named randomInteger(arr) ar lastIndexof(arr,…
A: It is defined as programs can be asked from control statements, array, string, oops etc. Java basic…
Q: Given the following method signature, write code that will shift all values of the array to the left…
A: Introduction of the Program: The Java program takes the size of the array from the user then the…
Q: In java, Write a method checks if a given matrix is a unit matrix. An N x N unit matrix is a matrix…
A: import java.util.Scanner; public class Solution{ /*Define a method to check if a given matrix…
Q: Write a program to accomplish the following tasks:- a) Write a method to print the ArrayList in the…
A: Write a program to accomplish the following tasks:- a) Write a method to print the ArrayList in the…
Q: A method named findElement that takes a double number and an array of double numbers as parameters…
A: NOTE: Since programming language is not mentioned. Therefore answering the question in Python…
Create a program whose Main() method declares an array of 10 integers. Call a method to interactively fill the array with any number of values up to 10 or until a sentinel value is entered. If an entry is not an integer, re-prompt the user. Call a second method that accepts out parameters for the highest value in the array, lowest value in the array, sum of the values in the array, and arithmetic average. In the Main() method, display all the statistics.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Create a class containing the main method. In the main method, create an integer array and initialize it with the numbers: 1,3,5,7,9,11,13,15,17,19 Pass the array as an argument to a method. Use a loop to add 1 to each element of the array and return the array to the main method. In the main method, use a loop to add the array elements and display the result. Note: In the loops, use the array field that holds the length of the array and do not use a number for array length.Create a program whose Main() method declares an array of 10 integers. Call a method to interactively fill the array with any number of values up to 10 or until a sentinel value is entered. If an entry is not an integer, re-prompt the user. Call a second method that accepts out parameters for the highest value in the array, lowest value in the array, sum of the values in the array, and arithmetic average. In the Main() method, display all the statistics.C# ProgramCreate a program whose Main() method declares an array of 10 integers. Call a method to interactively fill the array with any number of values up to 10 or until a sentinel value is entered. If an entry is not an integer, re-prompt the user. Call a second method that accepts out parameters for the highest value in the array, lowest value in the array, sum of the values in the array, and arithmetic average. In the Main() method, display all the statistics.Java Program
- Create a Golf Game. Allow for two players. Prompt for the player names. Each player plays 18 holes. Use an array or List for each player to hold their number of swings for each hole. Logical methods should be implemented for different tasks (broken out below). It is up to you to determine the parameters and return types of each method as appropriate. Method 1 - For each hole, the player has a number of swings. Determine the player's swings by generating a random number between 1 and 4. Store each players number of swings in the array/list. Method 2 - After completing the 18 holes, add up the number of swings for each hole for each player. The player with the fewest number of swings is the winner. Method 3 - Save the game data into a CSV file in the main project (root) directory. Name the file "Golf_Game_Player1_Player2.csv" using the player's names. The information in the file should look like this: playername, scoreforhole1, scoreforhole2, scoreforhole3, etc... Method 4 - In the…This is the question I am stuck on - In the exercises in Chapter 6, you created a class named Purchase. Each Purchase contains an invoice number, amount of sale, amount of sales tax, and several methods. Now, write a program that declares an array of five Purchase objects and prompt a user for their values. As each Purchase object is created, continuously prompt until the user enters an invoice number between 1000 and 8000 inclusive and a non-negative sale amount. Prompt the user for values for each object and then display all the values. This is the code that I am unsure where to fully start - public class Purchase { private int invoiceNumber; private double saleAmount; private double tax; private static final double RATE = 0.05; public void setInvoiceNumber(int num) { invoiceNumber = num; } public void setSaleAmount(double amt) { saleAmount = amt; tax = saleAmount * RATE; } public double getSaleAmount() { return…Question: 1. Write a method that has an int parameters. Creates an array of integers of that size. Reads in values for the array from the user. Returns the newly created array. 2 Write a method that given an array of integers.returns the index of the smallest integer.
- 2. write two method called findIndex and findLastIndex that search for a number in an array. they should take an int array and an int as parameters. findIndex should return the index of the first instance of the number in the array. findLastIndex should return the index of the last instance of the number in the array. They both should return -1 if the number is not found. Do not use any library methods. Sample code int a[] int x = findIndex(a,50); Sample output {10,50,30, 40,50}; 1 System.out.println(x); int a[] int x = findLastIndex (a,50); System.out.println(x); int a[] = {10,50,30,40,50}; int x = findIndex(a,70); {10,50,30,40,50}; 4 -1 System.out.println(x);Image one is my file or you can create ur own file as long as it's similar to mine. image 2 is my program I want to write a 4th method(method 4) and the spec is: A method to count the occurrences of each value in an array takes one parameter, an array of integers returns an array containing the number of times each value occurs in the parameter array. Also should call method 3 from method 4Hint: The general idea of this method is using an array with length maxVal+1(maxVal should get from method 3 already) to save the occurrences of each number. For example, if number 44 occurs 3 times in the file, your array should have a value 3 stored at index 44.Java: Write a complete method to create an array of random integers. Method Specification The method takes in three integer parameters: the array size, the lower bound, and the upper bound. The method also takes in a boolean parameter. The method creates and returns an integer array of the specified size that contains random numbers between the lower and upper bound., using these rules: The lower bound is always inclusive. If the boolean parameter is true, the upper bound is also inclusive. If the boolean parameter is false, the upper bound is not inclusive (meaning it is exclusive). If any of the parameters are invalid, null is returned. Driver/Tester Program I have provided you with a driver/tester program that you can use to test your code before submitting. Paste your code into the placeholder at the top of the file. I strongly recommend running this program before you submit your homework. The program is designed to help you catch common errors and fix them before submitting.…
- Java: Write a complete method to create an array of random integers. Method Specification The method takes in three integer parameters: the array size, the lower bound, and the upper bound. The method also takes in a boolean parameter. The method creates and returns an integer array of the specified size that contains random numbers between the lower and upper bound., using these rules: The lower bound is always inclusive. If the boolean parameter is true, the upper bound is also inclusive. If the boolean parameter is false, the upper bound is not inclusive (meaning it is exclusive). If any of the parameters are invalid, null is returned. Driver/Tester Program I have provided you with a driver/tester program that you can use to test your code before submitting. Paste your code into the placeholder at the top of the file. Review the Homework FAQ page, which contains instructions and a video of how to use the provided file. If you aren't sure how to use the tester or have any…Write a method that receives an array to determine how many scores are above or equal to the average. Assume that the maximum number of scores is 100. The header of the method is as follows:Create a class and a main() method that implements the following (define the local variables or additional arrays as you see necessary): Create a salary array (integer type) with 12 elements. Ask the user to input value from keyboard for each array element. If the input value is not between 0 and 15,000, keep asking the user to re-input till a valid value is obtained (hint: use a while loop). If one’s salary is higher than $8,000, he/she get 8% of his/her salary for bonus. Otherwise the bonus rate is 12%. After the salary information has been input for everyone, print out the salary and bonus for everyone. Each record in a separate line. Find out the highest bonus value and print it out.