For this exercise you will be creating 2 different arrays, both should store integers and be able to hold 5 elements. The user should be able to fill both up with different values. Once the arrays have been created and data is added to each array, you should add the elements at each index array 1 to the element at each index from the array 2. Please store the addition of each index in a new array and print this array out like shown below. As always: Remember, the class name should be Lab8B. The user input is indicated in bold. Sample Output #1: Please enter 5 integers for the first array: Integer 1: 4 Integer 2: 10 Integer 3: 50 Integer 4: 21 Integer 5: 5 Please enter 5 integers for the second array: Integer 1: 5 Integer 2: 1 Integer 3: 16 Integer 4: 4 Integer 5: 6 The resulting sums are 9|11|66|25|11||
Q: Write a program that will read up to ten letters into an array and write the letters back to the…
A: CODE:- #include <iostream>using namespace std;//Define constant sizeconst int SIZE = 10; int…
Q: We need to develop a game that allows two players to throw a dice ten times and the player who gets…
A: PROGRAM CODE: import java.util.*;public class Main{ static int sum(int[] values) { int…
Q: This is the question I am stuck on - In the exercises in Chapter 6, you created a class named…
A: The main objective of the program is to create three methods, called sortBySaleAmount,…
Q: write a Java code! Overview In this task you must write a class with which we can roll five dice…
A: import java.util.Random; public class Yatzy { int[] dices; public Yatzy() { this.dices = new…
Q: Create a class called Employee with three attributes: Name, Salary and Id. Make constructors,…
A: Answer is given below-
Q: Now take any name from the user, find whether that name is present in that array or not, and print…
A: As per the given problem, we have to design a Java program that searches for a string in a string…
Q: READY CAREFULLY Java add comment to code, please write your test-cases on how you would test your…
A: The answer is given below:-
Q: 15. Write a program that manages a list of up to 10 players and their high scores in the computer's…
A: Algorithm: 1. Take user input 1 for adding student, 2 for printing student, 3 for searching student,…
Q: Java : Overview You must write a class with which we can generate user identities for employees in…
A: public class Test { public static void main(String[] args) { String[] names = { "Bo Ek", "Erik…
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 code in JAVA for storing information of Employee using array. Employee attributes for…
A: Array of class type : An array is a collection of the homogenous data type. Arrays are two types…
Q: In this task you must write a class with which we can roll five dice and then check if we have got…
A: import java.util.Random; public class Yatzy { int[] dices; public Yatzy() { this.dices = new…
Q: In this assignment, you will implement a class calledArrayAndArrayList. This class includes some…
A: For the above program, we need to add the below mentioned functions or methods in java: ●…
Q: You will then create a separate class, Assignment8A. In its main method, you should do the…
A: It is tо write а C++ рrоgrаm thаt uses а struсture nаmed mоvie dаtа tо stоre the…
Q: Test the Baby class below by writing a client program which uses an array to store information about…
A: modified code(i remove isequals function as it is not necessary):- import java.util.Scanner;public…
Q: Problem #2: We need to develop a game that allows two players to throw a dice ten times and the…
A: An array is a data structure that contains the elements of the same type. It helps to store…
Q: Write a test program that creates two hexagons (5) and (10) and compares them using method…
A: string hexagon1 = "5"; string hexagon2 = "10"; Console.WriteLine("Comparing two Hexagons…
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: Prompt the user to enter an integer, then asks the user to enter that many values. Store these…
A: Prompt the user to enter an integer, then asks the user to enter that many values.Store these values…
Q: Please use java. Write array methods that carry out the following tasks for an array of integers by…
A: Answer: Java Source Code: WorkingWithArrays.java: import java.util.Arrays;import java.util.HashSet;…
Q: FOR JAVA Write a class named Matrix that has a 2 dimensional double array to hold the values of the…
A: FOR JAVA Write a class named Matrix that has a 2 dimensional double array to hold the values of…
Q: Create a class named Problem1, the program (Java) would do the following: -The program prompts the…
A: The answer to the given question is in subsequent steps.
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: You have probably come into contact with the dice game Yatzy1 before. In that game, it is a matter…
A: The below code is the solution for above problem statement....
Q: Test your Baby class by writing a client program which uses an array to store information about 4…
A: Programming instructions: Define class. Declare the required variables. Create a default and…
Q: Array A before calling *4:Zerca O12040 102340 120046 1023 1234 Array a after the call vetZeroe (A)…
A: I'm providing the code in java for the above question. I hope this will be helpful for you..
Q: Write a java program that: Declare an array capable of holding 4 integers. It must be 4 integers…
A: import java.util.Scanner; public class ExpandArray { public static void main(String[] args) {…
Q: For some reason I have 2 programs that aren't running. This is the second one, please let me know if…
A: This sort of import proclamation is vital. They tell the arrange of which sort of Scanner you are…
Q: The three parallel arrays are gone — replaced with a single array of type PhonebookEntry. You…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: Write a program, Passwords , that contains an array of five names and another array of five…
A: Note: - As the programming language is not mentioned to write the program. So, I am using JAVA to…
Q: You will write a program that takes a set of numbers from the users. In this assignment, you should…
A: Programs are used to provide instructions to the computer systems, in order to solve complex…
Q: In a previous homework assignment, you solved Exercise 5.5, Problem 12 (on Page 287 of Fourth…
A: (1)Declare the array (2)Initialize the count to 0 for each number (3)Generate the random number…
Q: I need to have a main method in a Tester class that will: Fill an array of type Vehicle[] of size…
A: class Vehicle{ private double efficiency; Vehicle(double efficiency){ this.efficiency=efficiency;…
Q: e ARROVER3 program in this chapter so that the user can specify both the upper and lower bound of…
A: Please Solve the Question in C++ as quickly as you can in 40 minutes. And do the same as asked in…
Q: The value of the length property can be reduced without removing items from an array. True False
A: The length property returns the length of an array. The length of an array refers to the number of…
Q: aled fine and findLastindex that search an array. the should take an int array and an int as…
A: The complete code is given below with output .
Q: In this task you must write a class with which we can roll five dice and then check if we have got…
A: public class TestYatzy { public static void main(String[] args) { int games = 10000000, yatzyCount…
Q: Write a Java application to simulate the rolling of two dice. The application should use an object…
A: Class: DumDice.java //Code public class SumDice { public static void main(String[] args) {…
Q: PLease use java In this assignment, you will implement a class called ArrayAndArrayList. This class…
A: Three separate .java files are written. One for the implementation of ArrayAndArrayList class along…
Q: In the Utils class provided to you in this exercise, please fill in the details for a method called…
A: Code public class Main{ public static void swapArray (int[]theArray, int i, int j) { int temp;…
Q: Write the method body of following function: void ReplaceAll(int num, int numWith) Above method…
A: In this, I have completed this function which will print the count of the number of times a given…
Q: Given your array declared above, and assuming your program has already read in a certain number of…
A: Below is the required program in C++ language. NOTE: As the array declaration is not given by you.…
Q: method called manipulate-2-Dim that receives a two-dim array of integer numbers called a matrix. The…
A: Write a method called manipulate-2-Dim that receives a two-dim array of integer numbers called a…
Q: Test your Baby class by writing a client program which uses an array to store information about 4…
A: Basically, a class named Baby is implemented which has name and age as its member, along with few…
Q: Write a code in JAVA for storing information of Employee using array. Employee attributes for…
A: Note : No output is given for this solution as it is mentioned not to write the main method .I have…
Q: In the following code both myList and yourList are dynamic arrays of the same size. The code…
A: PROGRAM: //Header file #include <iostream> //Using namespace using namespace std; //Defining…
Q: READY CAREFULLY Java add COMMENT TO CODE, please TEST-CASE on how you would test your solution…
A: Find the duplicates in two sorted arrays : program in java: public class arrayduplicates {…
Q: You should decide the appropriate declaration and implementation. Write a test class create array of…
A: To Do: Write a Java program that solves each part.
Q: Write a class AnalyzeNumbers which asks the user to enter the number of inputs andstores them in an…
A: Program plan:Define the class “AnalyzeNumbers”.Define the “main()” method.Create object for…
language is c++
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- Write code that will accept as input the characteristics of an undefined number of different softdrinks. Each softdrink should have a colour (of the can), name and volume. • Create SoftDrink objects and store them in an ArrayList (see the Appendix) as each softdrink is entered. • Alternatively, you can use an array. Take a number of items first, create an array of that size and read in the elements. • Prompt the user to add a softdrink until they choose to quit. • Once the user quits, print out a list of the softdrinks that the user has entered, sorted first by alphabetical order of name, then by colour, then by volume (ascending order). Name your driver class Question2.java. NOTE: • You can use the built-in static sort() method in the java.util.Collections class to sort your ArrayList of SoftDrink objects. Sample I/O Enter option: (1) add soft drink (2) quit: 1 Enter name, colour and volume in ml separated by space Fanta Orange 500 Enter option: (1) add soft drink (2)…part a- 2point) for 3 students find the average of a student by asking him how many grades do you have. The answer to this question, determine the size of the array(list of grades) and then ask the user to enter grades(the number of the grades is equal to the size of the array) then calculate the average for each student. Hence, you will calculate 3 averages. to calculate the average, use the array accumulator. Also when you get each grade validate it. validation for grade means that you check whether a grade is between 0 and 100. if the grade is negative or a grade is more than 100 then it is not valid and you have to ask the user to enter a grade again. Part b- 1 point) Find the maximum and minimum grades for each student. Part c- 1 point) Print the sorted list of the grades for each student. example: if grades user entered are: 60 78 98 23 45 then sorted list is:23 45 60 78 98 (Array not vector)JAVA Your teacher has created two arrays, each holding the results of tests, say Test 1 and Test 2. You need to create a new array which holds the averages of these two tests. You may assume that the first element of the first test array refers to the student who also has the grade in the first element of the second test, and the last element in each array are the grades the last student earned for each test. All students received grades for both tests, meaning both test arrays are of the same length. Complete the method, named makeAverage, in the class named Grades.java. There are two parameters to this method: the first is the integer array representing the grades of the first test, and the second is the array containing the grades of the second test. The new average array should be returned by the method. The grades should be treated as double variables. For example, consider the test grades for the five students in the following arrays: [ 87 ] [ 91 ] [ 76 ] [ 76 ] [ 94 ]…
- ________&___In between creates array of 10 integers. Ask the user to enter the data in the array. Each time the data entered in the array should be unique. Your program should not allow the user to enter the duplicate values in the array. After feeding data into the array created, create another array of the 10 integers and save the data of 1st array in the reverse order into the second array. For Example Array 1 1 2 3 4 5 6 7 8 9 10 Array 2 10 9 8 7 6 5 4 3 2 1іmрlеmеոt thе fоllоwіոg ехрrеssіоո іո аssеmbly lаոguаgе: Create a DWORD array named ‘z’ of size 3 using DUP operator. Leave the array ‘z’ uninitialized. You can denote the items in the array as [ z0, z1, z2]z0, z1, z2] , where z0z0 is the first item, z1 z1 is the second item, z2z2 is the third item Update each array item using the following expressions. z0=x+130z0=x+130 z1=y−x+ z0z1=y−x+ z0 z2=r+x−z1z2=r+x−z1 Where x, y, r are 16-bit integer memory variables. x = 10, y = 15, r = 4 Use mov, movzx, movsx, add, sub instructions only. (hint: Do not alter the value of x, y and r during the computation. Transfer them to appropriate registers to do computation) At the end, open memory window to see the variable z stored in memory (little endian format). Use the debugger to verify your answer.RU Rotten Tomatoes . Write a program RURottenTomatoes.java that creates a 2 dimensional integer array of movie ratings from the command line arguments and displays the index of the movie that has the highest sum of ratings. Ratings range from 1 to 5 (inclusive). The rows of the 2D array correspond to movie reviewers and the columns of the 2D array correspond to movies. The reviewer at index 2 gave movie at index 0 a rating of 4. Take a look at the following example for an explanation on the command line arguments sequence. java RURottenTomatoes 3 2 5 2 3 3 4 1 0 1 0 5 2 1 3 3 2 4 1 The first argument corresponds to the number of reviewers and the second argument corresponds to the number of movies (the dimensions of the 2D integer array). Following are the movie ratings in a row-major order.…
- 3. Find the Culprit by CodeChum Admin "Help!!!" Someone's calling for help! It seems that someone was robbed and their phone was stolen. Luckily, the phone's GPS is turned on so we can track the culprit's coordinates! Instructions: Ask the user for the number of rows and columns of a 2D array and then its elements. Then, ask the user for another integer value which represents the culprit. Finally, go through the 2D array and find the culprit's coordinates - its row number and column number and display them. Input 1. Number of rows 2. Number of columns 3. Elements of the 2D array 4. Culprit's value Output Print the row of the position first and then the column of the position. Note that the row and the column is 0-based (i.e. it starts at 0 and not at 1). It is guaranteed that the culprit exists only once in the 2D array. Enter # of rows: 4 Enter # of columns: 4 Elements: 1 4 2 3 9 1 2 3 4 2 1 1 9 2 8 3 Enter the culprit's value: 8 Culprit's·position: 3, 2Return the maximum value from the provided integer array. You may assume that all values in the array will be non-negative. getMax([1]) → 1getMax([0, 3, 2, 12, 4]) → 12getMax([15, 3, 1, 7, 2]) → 15 public int getMax(int[] nums) { Write your code in here using this outline.}JavaScript 4. Calculate the sum of numbers within an arrayYou can create your own array of numbers but consider trying this problem with a few different sets to verify your solution. Have one array with negative and positive numbers and another with integers and decimals. You could also try using arrays of different lengths. If you're feeling comfortable with this, try the slightly more challenging bonus challenge below. Bonus intermediate challenge: Create a function that can return the sum of a particular column or row number in a table.
- 2DArray method:It will allocate a block of memory which represents a two-dimension arraybased on the input values supplied by the user. Ask the user to enter the number of rows andcolumn for 2D array that the user want to manipulate. The number of rows and columns that theuser enters may or may not define a square matrix (when the number of rows equals the numberof columns). The array will have exactly rows time columns (m * n) elements. It will notcontain any extra or empty cells. Initialize the “matrix” by rows with random number between 1to 100. Pass two arguments by out reference so that you can assign the number of row andcolumns of data to the first and second arguments. This is return 2D array method afterallocating new memory for 2D array and initialize it with random value. Generate randomnumber code in C# as following: Random randnum = new Random( );int number = randnum.Next (1, 101);SwapRow method: it will rotate the data in the matrix in an up/down method such that the…A personal phone directory contains room for first names and phone numbers for 30 people. Assign names and phone numbers for the first 10 people. Prompt the user for a name, and if the name is found in the list, display the corresponding phone number. If the name is not found in the list, prompt the user for a phone number, and add the new name and phone number to the list. Continue to prompt the user for names until the user enters quit. After the arrays are full (containing 30 names), do not allow the user to add new entries. Use the following names and phone numbers: Name Phone # Gina (847) 341-0912 Marcia (847) 341-2392 Rita (847) 354-0654 Jennifer (414) 234-0912 Fred (414) 435-6567 Neil (608) 123-0904 Judy (608) 435-0434 Arlene (608) 123-0312 LaWanda (920) 787-9813 Deepak (930) 412-0991A personal phone directory contains room for first names and phone numbers for 30 people. Assign names and phone numbers for the first 10 people. Prompt the user for a name, and if the name is found in the list, display the corresponding phone number. If the name is not found in the list, prompt the user for a phone number, and add the new name and phone number to the list. Continue to prompt the user for names until the user enters quit. After the arrays are full (containing 30 names), do not allow the user to add new entries. Using Scanner.input to prompt user, Use the following names and phone numbers: Gina (847) 341-0912 Marcia (847) 341-2392 Rita (847) 354-0654 Jennifer (414) 234-0912 Fred (414) 435-6567 Neil (608) 123-0904 Judy (608) 435-0434 Arlene (608) 123-0312 LaWanda (920) 787-9813 Deepak (930) 412-0991