Given a program called Identical.java, I need to complete the two missing lines (34 and 38), and replace the "?". The program includes two int arrays, and the output is True if the two arrays are identical and False if they are not.
Q: I want to create a program called Guests.java that prompts a user to enter how many guests he will…
A: Algorithm: Start Read number of guests n Declare a string array of size n Read first names of n…
Q: I need help to write this code in JAVA with comment please Write a program that stores the…
A: Program code: //import the required package import java.util.Scanner; //define the class…
Q: (Needs to write a java program. The imput file that the code will be tested on will be really large,…
A: ANSWER:
Q: (B) Write a Java program that crates an array of 100 random lowercase letters, and then converts a…
A: The name of the Java class is Letters. Using the block/paragraph comment write the student name and…
Q: Write a method named swapPairs that accepts an array of strings as a parameter and switches the…
A: We create a method called swapPairs with an array of strings as a parameter. We take the value of…
Q: in array size is 12 and i want display 10 largest numbers?
A: The java program to along with the snapshot of code and output.
Q: a. Write a program to multiply all the elements in the array by 2 b. If you declare an array as…
A: Given: a. Write a program to multiply all the elements in the array by 2 b. If you declare an…
Q: Given that integer array x has elements 4, 7, 3, 0, 8, what are the elements after the loop? inti;…
A: The correct option is option b i.e. 7, 3, 0, 8, 8
Q: In a 2-dimensional array, all rows must contain the same number of columns. In other words, we can…
A: Explanation : Java does not actually have two-dimensional arrays. In a true 2D array, all the…
Q: Write a Java application and use a Two dimensional array to store five Dutch, French and Italian…
A: One-dimensional array: A one-dimensional array is a type of linear array. Accessing its elements…
Q: Given below is an array that contains the runs scored by the 11 players of a cricket team in a…
A: In normal circket any player who scored>=100 is considered that he scored a century. So i will…
Q: (B) Write a Java program that crates an array of 150 random uppercase letters, and then converts a…
A: In Java, Math.random() is used to return a pseudorandom double type number greater than or equal to…
Q: Write a Java program to display a three_month delivery report for three different years. The…
A: use nested loop to iterate through each elements except 0th column. since 0th column is containing…
Q: Write a program that reads in ten integers and displays the number of distinct numbers and the list…
A: logic: - public static int findDistinctNumbers(int arr[],int outputArr[]) { int i,j,k=0;…
Q: Write the output of the following Java program segment. Write only the output, nothing else!…
A: Here ArrayList<Integer> a2 will be {20,24,28,32,36,40} Hence System.out.println(a2.get(4) -…
Q: a program called Range_array.java that has a method with one integer array and two integers…
A: We need to implement the Range_array to create an array with given data and then delete the elements…
Q: Asking again. IN JAVA please Given a text file containing the availability of food items, write a…
A: Code Screenshot :
Q: This code is in java. Part A: Your friend’s photo editing software has stopped working so you…
A: public class MyClass {int[][] arr;public MyClass(int a,int b){arr=new int[a][b];int count=0;for(int…
Q: Write a Java program named Findletter that asks the user to enter 10 letters and store them in an…
A: The required Java code is given below: import java.util.Scanner;public class Findletter{ public…
Q: You are given an array of integers below. Write a Java program to perform the following operation on…
A: Given: An array of integers is given. int []arr = {12, 7, 12, 53, 2, 5, 49, 5, 21, 0} Requirement:…
Q: Write a Java program to make two arrays containing random integer values (You can make these arrays…
A: ALGORITHM:- 1. Declare a driver class. 2. Define all the functions as required. 3. Call all the…
Q: Write a Java program to make two arrays containing random integer values (You can make these arrays…
A: public class Main{ int[] makeRandomArray(int size, int a, int b){ int arr[]=new int[size];…
Q: Given an array containing integers with N elements, and the sum of consecutive elements in the array…
A: Here is the solution which is mentioned below:
Q: a program (its name should be StudentPoll.java) which first reads an integer, N, for the number of…
A: Actually, program is a executable software that runs on a computer.
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: In this Java project you are asked to write code to obtain the grade of a student for a semester,…
A: Step2: Written code Step3: Screenshot and output of the code
Q: Given below is an array that contains the runs scored by the 11 players of a cricket team in a…
A: This question explains about JAVA program :
Q: Write a program with java that takes 10 numbers from user, then prints first largest and second…
A: Coded using Java.
Q: Write a Java program that will create a report to display the top three mobile device sales per…
A: Algorithm: Start Store the given data in arrays Iterate through the arrays and print the data in…
Q: 1. Write a complete Java program named FindAverage that contains the following: a. A main method…
A: import java.util.Scanner;import java.util.Random; public class Main //FindAverage{ public…
Q: 1. Write a method that returns an int array using user's inputs from the console window. The method…
A: Java Code :- package homework; import java.util.Arrays; import java.util.Scanner; public class HW8…
Q: Using Java, Dr. Choi has 5 students who took a midterm and final. 1.First, she wants to store…
A: Solution: Java code: Main.java import java.util.Scanner;public class Main{ //find the…
Q: Write a program in Java that reads integers, one per line, and displays their sum. Also, display all…
A: Code : import java.util.Scanner; public class IntegerStatistics { public static void main(String[]…
Q: Write a complete java program called Marks. Which will do the following tasks: 1- This program…
A: import java.util.*;public class Main{ public static void main(String[] args) { int course;…
Q: Write a JAVA program that plays a simple trivia game. The game should have five questions. Each…
A: Define a class. Declare string type arrays for containing question and answer. Declare int type…
Q: Write a Java program to make two arrays containing random integer values (You can make these arrays…
A: hi there , in the code, as mentioned above i have used all four methods 1.int[] makeRandomArray():…
Q: Write a java program called GradesAverage, which prompts user for the number of students, reads it…
A: Answer is given below .
Q: Write a program to do the following task: Declare a two-dimensional array with 3 rows and 4 columns…
A: Java Program for above : import java.util.Random; class Prog{ public static void main…
Q: ze of the 2D square array. Assume the size is at least 5 . Note that the array size may be an even…
A: Code: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: write a java program that contains 2 arrays, one for 10 students names and the other for their…
A: Logic: Accept names from the user and keep it names array which is one dimensional. Accept grades…
Q: Write a Java program that creates and initializes an array of integers. Then it reads from the user…
A: Required: Write a Java program that creates and initializes an array of integers. Then it reads from…
Q: You are walking along a hiking trail. On this hiking trail, there is elevation marker at every…
A: The method you needed private static boolean dangerousDescent(int[] array) { //…
Q: How many elements are in the array? int[][] userVals = new int[2][4]; A. 2 B. 4 C. 6 D. 8
A: Solution:
Q: Write a Java program that obtains products' numbers (array named products[]), and allows the user to…
A: The Answer is given below step.
Q: Write a program that reads in ten integers and displays the number of distinct numbers and the list…
A: Find the required code in java given as below and output :
Q: Write a Java program (BasicStatistics.java) that prompts the user to enter 10 numbers as double…
A: Java code to calculate the mean and standard deviation. Comment are add in the code only. Here…
Q: Write a program that inputs 10 strings that represent floating-point values, converts the strings to…
A: Since the programming language is not mentioned, I have done the code using C language.
Q: Can you help with the following question? Write a Java program that creates and initializes an…
A: Required: Write a Java program that creates and initializes an array of integers. Then it finds and…
Q: Write a simple polling program that allows users to rate five topics from 1 (least important) to 10…
A: Pogram code #1:
Q: Read and understand the statements. Choose the correct answer from the choices given. 1. If you…
A: Note: we are only allowed to solve one question in one post. to get answers to others, please post…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- import java.util.ArrayList;import java.util.Scanner; public class LabProgram { /** * @param args the command line arguments */ public static ArrayList<Employee> employees=new ArrayList<Employee>(); public static void display(ArrayList<Employee> employees){ /* displays information on all employees in the arrayList employees */ /* Type your code here */ } public static void main(String[] args) { Scanner kb=new Scanner(System.in); String employeeType=kb.next(); String name; while (!employeeType.equals("q")) { name = kb.next()+ " " + kb.next(); if (employeeType.equals("H")) employees.add(new HourlyEmployee(name, kb.nextInt(), kb.nextInt())); else employees.add(new SalaryEmployee(name, kb.nextInt())); employeeType = kb.next(); } display(employees); }} public abstract…import java.util.Scanner; public class ModifyArray { public swapArrayEnds(10, 20, 30, 40) { for (i = 0; i < (arrVals.length / 2); ++i) { tempValue = arrVals[i]; // Do swap //*please fix code// arrVals[i] = arrVals[arrVals.length - 1 - i]; arrVals[arrVals.length - 1 - i] = tempValue; Write a method swapArrayEnds() that swaps the first and last elements of its array parameter. Ex: sortArray = {10, 20, 30, 40} becomes {40, 20, 30, 10}. public static void main (String [] args) { Scanner scnr = new Scanner(System.in); int numElem = 4; int[] sortArray = new int[numElem]; int i; int userNum; for (i = 0; i < sortArray.length; ++i) { sortArray[i] = scnr.nextInt(); } swapArrayEnds(sortArray); for (i = 0; i < sortArray.length; ++i) { System.out.print(sortArray[i]); System.out.print(" "); } System.out.println(""); }}Please help me fix this code Make it run out like the picture import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class FrogListApp { public static void main(String[] args) { final int MIN_WEIGHT = 1; final int MAX_WEIGHT = 25; // Step 3: Create an array list to store Frog objects ArrayList frogsList = new ArrayList<>(); // Step 4: Create a Scanner object Scanner scanner = new Scanner(System.in); // Step 5: Read an integer as the number of frogs // using prompt "Enter the number of frogs: " System.out.print("Enter the number of frogs: "); int numberOfFrogs = scanner.nextInt(); // Step 6: Read an integer as the random generator seed // using prompt…
- import java.util.Arrays; import java.util.Random; public class Main { public void Start(){ int[] array = {3, 6, 1, 4, 2, 9, 7, 8, 5, 0}; int key = 1; Arrays.sort(array); //sort array int result = binarySearch(array,key); //Print values in array after sort System.out.println(result); } int binarySearch(int arr[], int key){ // put your code here. } public static void main(String[] args) { Main main = new Main(); main.Start(); } } --------------------------------------------------------------------------------------------------------------------------------------------------------- Given a sorted array named arr of n elements, write a function to search for a given element x in arr. If the element is present, return the index of x in the array. If the element is not present, return -1. Don't forget that arrays are 0-base-indexed, meaning that the first element in…Beginner Java import java.util.Arrays;import java.util.Scanner; Arrays and scanner required. Suppose that a Scanner object contains a bunch of tokens all on a single line separated by spaces. For example: 100.5 65 pizza 100 45.75 70 5.8 5 Also suppose that you have two integers n and m that are both positive. For example: n = 5 and m = 10 Write a static method: public static double partialSum(Scanner s, int n, int m) that takes a Scanner and two integers n and m as arguments and returns the sum of the integers read by the Scanner that are divisible by n and not divisible by m. In the above example, the integers divisible by 5 and not divisible by 10 are 65 and 5, so the result would be 70. If the Scanner is empty, or no tokens are valid integers, the result should be 0. You can assume the Scanner is not null. It is probably easiest to test your method by creating a Scanner with a String instead of System.in. The starter code for an example of how to do this is…import java.util.Scanner;import java.util.ArrayList; public class PhotoLineups { // TODO: Write method to create and output all permutations of the list of names. public static void printAllPermutations(ArrayList<String> permList, ArrayList<String> nameList) { } public static void main(String[] args) { Scanner scnr = new Scanner(System.in); ArrayList<String> nameList = new ArrayList<String>(); ArrayList<String> permList = new ArrayList<String>(); String name; // TODO: Read in a list of names; stop when -1 is read. Then call recursive method. }}
- How can i make this data enter and enter as a table in java. Please dont use array import java.util.Scanner;public class BMI {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);String first_name;int kg ;double height;double bmi; for(int i=1; i<4; i++) {System.out.print("NAME ");first_name=scanner.next();System.out.print("WEIGHT, kg");kg=scanner.nextInt();System.out.print("HEIGHT, m");height=scanner.nextDouble();System.out.print("BMI");bmi= kg / (height * height);System.out.println(bmi);}// System.out.println("NAME\tWeight\tHeight\tBMI");// for(int i=1; i<4; i++) {// System.out.print(first_name);// System.out.println(first_name+"\t"+kg+"\t"+ height + "\t"+ bmi);// }}}[java] Write a two-dimensional transformation library by implementing the following API: public class PolygonTransform { // Returns a new array object that is an exact copy of the given array. // The given array is not mutated. public static double[] copy(double[] array) // Scales the polygon by the factor alpha. public static void scale(double[] x, double[] y, double alpha) // Translates the polygon by (dx, dy). public static void translate(double[] x, double[] y, double dx, double dy) // Rotates the polygon theta degrees counterclockwise, about the origin. public static void rotate(double[] x, double[] y, double theta) // Tests each of the API methods by directly calling them. public static void main(String[] args) }Write the complete Java code and explain the code Remove all errors from this code import java.util.*; import java.io.*; class Main { public static void main(String args[]) { // taking input using class Scanner Scanner sc = new Scanner(System.in); // taking total count of testcases int t = sc.nextInt(); while (t-- > 0) { // taking size of subArrays int k = sc.nextInt(); // Declaring and Intializing an array of size n int arr[] = new int[n]; // adding all the elements to the array for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } // Calling the method max_of_subarrays of class solve // and storing the result in an ArrayList ArrayList<Integer> res = new Solution().max_of_subarrays(arr, n, k); // printing the elements of the ArrayList for (int i = 0; i…
- import java.util.ArrayList;import java.util.Random; class Main { public static void main(String[] args) { Random rand = new Random(); ArrayList<Integer> a = new ArrayList<Integer>(); for(int i = 0; i < 100; i++) { a.add(rand.nextInt(100)); } print(a); System.out.println("----"); sort(a); print(a); // simplified Quicksort public static void sort(ArrayList<Integer> a) { if (a.size() <= 1) return; // Pick a Pivot int m = a.size() / 2; int pivot = a.get(m); } ArrayList<Integer> smaller = new Arraylist<Integer>(); ArrayList<Integer> same = new ArrayList<Integer>(); ArrayList<Integer> larger = new ArrayList<Integer>(); for (Integer x : a) { if (x < pivot) { smaller.add(x); } else if(x > pivot) { larger.add(x); } else { same.add(x); } } sort(smaller); sort(larger); a.clear(); a.addAll(smaller);…Write and test a Java program that processes arrays as follows: Code a class that is called myArray consisting of the following methods: a. build and return an array of integer values (size 20 elements) b. search the array for a given element (linear search) c. Insert an element into the array after a certain element already contained in the array. This involves shifting array elements . and will require defining an array which has additional unused cells d. remove an element in an array (requires the use of searching and collapsing the array so that there are no gaps.) e. Write a method that uses a nested loop structure to create a 2-dimensional character array consisting of 6 rows and 4 columns. f. Write a method that reads the elements of the 2-D array, and displays the array contents (elements) one row per line.public class DynamicArray { private int array[]; private int count; private int size; public DynamicArray() { array = new int[1]; count = 0; size = 1; } public void add(int data) { if (count == size) { growSize(); // make array size double } array[count] = data; count++; } public void growSize() { int temp[] = null; if (count == size) { temp = new int[size * 2]; { for (int i = 0; i < size; i++) { temp[i] = array[i]; } } } array = temp; size = size * 2; } public void shrinkSize() { int temp[] = null; if (count > 0) { temp = new int[count]; for (int i = 0; i < count; i++) { temp[i] = array[i]; } size = count; array =…