Programming Logic & Design Comprehensive
9th Edition
ISBN: 9781337669405
Author: FARRELL
Publisher: Cengage
expand_more
expand_more
format_list_bulleted
Question
Has to be done in C#
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Similar questions
- Complete the method endsInFive that takes as arguments a 2D-array of integers and an integer value that represents a column index in the array. endsInFive returns the number of values in the column that end in 5. It is possible that the array is ragged, meaning that the number of columns in each row is different. For example, 2 is returned if the following 2D-array is passed as the first argument of endsInFive and the integer 3 as the second argument (the values 25 and 115 end in five at column index 3).arrow_forwardJava programming Write a method that takes an array of integers as a parameter. The method should return the occurrence of the even numbers in the passed arrayarrow_forwardWrite a call to Arrays static method equals with arguments arrayl and array2.arrow_forward
- Searching and sorting in Java programming: Write a method remove, that takes three parameters: an array of integers, the length of the array, and an integer, say removeItem. The method should find and delete the first occurrence of removeItem in the array. If the value does not exist or the array is empty, output an appropriate message. Note: after deleting the element, the array size is reduced by 1. You may assume that the array is unsorted. Thank you. I took Java in 2012 and 2013, and we didn't go too deep in this cocept..just a little bit in the Arrays chapter. i wanted to try something ne! Thank you!arrow_forwardTableAA.java Write a program that will store a multiplication table in a 2-D array. The user will enter how many lines (rows) it will have. The table will be printed to the screen. (Make it look nice – consider using printf.) This program will contain a static method. This method will take in an integer (the user’s number) and it will return a 2-D array. The code inside of the method will create the array, fill it with all the appropriate values that one would expect in a multiplication table, and then return that filled array. In the main method, you will ask the user how many lines they want to see and then you will use your static method to get the array. Once you have the array back from the static method, use nested for loops to print it in table form. See samples on the following pages. Program only needs to run once. Add try/catches so the user can only enter positive integers (1 and higher).arrow_forwardJAVA Chapter 9 Multidimensional Arrays and the ArrayList Class Write a value returning method that returns the sum of the elements in the last column of each row in a two-dimensional array of ints. Include code to test your method.arrow_forward
- Java Complete the method with explaining, thank you!arrow_forwardjava getDup accepts an array and returns an int. If there is any element is duplicated, the method counts how many of those present in the array. Example : getDup(["1","2","aa"',"1"]) returns:2 ("1" is duplicated and there are two "1"s so return is 2) class Main { public static int getDup(String[] r) { } public static void main(String[] args) { Scanner in = new Scanner(System.in); String [] strs = new String[in.nextInt()]; for(int i=0; i < strs.length; i++) { strs[i] = in.next(); } System.out.println(getDup(strs)); } } hint: you will need a nested array the will run on the array we get from the method argument. inside the nested loop you will need to check if the main array element is equal to the currentarrow_forwardWrite the following method that returns the locationof the smallest element in a two-dimensional array.public static int[] locateSmallest(double[][] a)The return value is a one-dimensional array that contains two elements. Thesetwo elements indicate the row and column indices of the smallest element in thetwo-dimensional array. Write a test program that prompts the user to enter a twodimensionalarray and displays the location of the smallest element in the array.Here is a sample run: Enter the number of rows and columns of the array: 3 4↵EnterEnter the array:23.5 35 2 10↵Enter4.5 3 45 3.5↵Enter35 44 5.5 9.6↵EnterThe location of the smallest element is at (0, 2)**arrow_forward
- Write a method with header static void DisplayIntArray(int[] numbers). The first argument is an array of ints. There is no return value. This method displays all the elements of the argument on a single line. Each item will occupy three columns.Call this method from main with a suitable argument. Write a method with header static int[] GenerateRandomIntArray(int numberOfItems, int largestValue). The first argument is an int indicating the number of elements that will be present in the return array. The second argument is an int representing the largest item in the array. The returned value is an array of integers. This method does the following: Declare and initialized a variable of type Random (Random generator = new Random();) Declare an array of type int (you may call it result) Allocate storage for the correct number of items Using your favorite looping statement, assign a random integer to each element of the array (result[i] = generator.Next(largestValue);) In your…arrow_forwardX908: expandAndCopyArray Write a method that takes an argument representing an array, orig, and returns a new array that is 50% bigger than the original one. The new array should also have all the values copied over to the new array. Examples: expandAndCopyArray ({1, 10)) -> (1, 10, 0) Your Answer: 1 public static int[] expandAndCopy (int[] array) 2 ( 3)arrow_forwardDNA Max Write code to find which of the strands representing DNA in an array String[] strands representing strands of DNA has the most occurrences of the nucleotide represented by parameter nuc. Complete the definition of the class DnaMax and method definition maxStrand shown below. If more than one strand has the same maximal number of the specified nucleotide you should return the longest strand with the maximal number. All DNA strands have different lengths in this problem so the maximal strand will be unique when length is accounted for. Return this uniquely maximal strand. Each String representing a DNA strand will contain only cytosine, guanine, thymine, and adenine, represented by the characters 'c', 'g', 't', and 'a', respectively. If no strand in the array contains the specified nucleotide return the empty string "". public class DnaMax { public String maxStrand(String[] strands, String nuc) { // fill in code here } } Constraints strands will contain no more than 50 elements,…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,