Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Write a java program contains two methods:
1. In the main method:
You will declare an array of any size you want then send it to another method to find the largest value and then print it.
2. In the large method:
You will search in array for the largest number and return it to the main method to print it.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Similar questions
- In java i have some code for a method that finds the index of an integer that is passed in thet int is (target) the method also has the array called (array) and the first and last element of the array. also for this method to work the array has to be in descending order "static int find(int [] array, int first, int last, int target)" thats the method with all the variables that are passed to it my guess is that the first if statement just will have a short line that is "return -1;" because since the array has to be in descending order the first element cant be greater then the last element in the array but im confused on the rest because i cant find a way to make them one line codes with the conditions that i have to meet in the comments any help would be aprreaciatedarrow_forwardWrite a Java program (Hangman.java) to play the classic word game Hangman. In the game, a word is randomly selected from an array of possible words. Then, the user is prompted to guess letters in the word one at a time. When the user makes a correct guess, all instances of that letter in the word are shown. When all letters in the word have been guessed, the game ends and the score (number of missed guesses) is displayed. A user can play the game multiple times if they choose. Here is a sample run of a correct program (user input indicated by orange text):Enter a letter in word ******** > cEnter a letter in word c******* > rEnter a letter in word c******r > s s is not in the wordEnter a letter in word c******r > tEnter a letter in word c****t*r > mEnter a letter in word c*m**t*r > t t is already in the wordEnter a letter in word c*m**t*r > pEnter a letter in word c*mp*t*r > oEnter a letter in word comp*t*r > eEnter a letter in word comp*ter >…arrow_forwardAn incomplete program named w_pl java, which must include three methods, is provided. You must implement two methods within the program as described below. The third method, which is a main method, is already written in the program and you can use it to test your program. The two methods you mast inplement are: • find method • Signature: public statie vold find(int[] a, int x) • Behavior: • Reccives an array of integers a and an integer x • Performs a linear search on a for x. • If x is in a, print the indexes of the aray slots where x is stored (there may be multiple x's in a) on the screen. • Ifx is not in a, print the message "x does not exist" on the screen. Note that you should not use Java's built-in method. Your program must scan and search the array. • isPrifie method • Signature: public statie boolean isPrefix(String s1, String s2) • Behavior: • Receives two strings sl and s2. Assume that length of sl length of s2. Returns true if sl is a prefix of s2 and returns false…arrow_forward
- Problem: Write a method that will determine whether a given value can be made given an array of coin values. For example, each value in the array represents a coin with that value. An array with [1, 2, 3] represents 3 coins with the values, 1, 2, and 3. Determine whether or not these values can be used to make a desired value. The coins in the array are infinite and can only be used as many times as needed. Return true if the value can be made and false otherwise. Dynamic Programming would be handy for this problem. Data: An array containing 0 or more coin values and an amount. Output: Return true or false. Sample Data ( 1, 2, 3, 12, 5 ), 3 ( 4, 15, 16, 17, 1 ), 21 ( 1 ), 5 ( 3 ), 7 Sample Output true true true falsearrow_forwardUSING JAVA Create a method that randomly select a letter in the alphabet (the random should be in another method including the main method )arrow_forwardin javaarrow_forward
- Write a java program that prompts user for 10 numbers of any type and stores them in an array. Then print the following: All the values in the array. The sum of all values in the array. The average of all values in the array. The largest value in the array. The smallest value in the array. All the positive numbers in array. All the negative numbers in array. All the odd numbers in array. All the even numbers in array.arrow_forwardWrite a Java method (do not write a class, only the method) with the following signature: Return type: void Parameters: 2D integer array Name: printDiagonal Implement the method code that will print out the values of the 2D array along the Diagonal from left to right. For example, if the array had the following values: 56 78 98 21 33 55 98 44 11 The method should print to the console: 56,33,11 The above 2D array example is only given for you to understand the problem Do not hard code the values in your solution or assume the array is the same as the given data. Your method should work for all 2D integer arrays.arrow_forwardhelp asaparrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY