Given the program below, what is the output if the user enters 3 in response to the
Question:
Given the program below, what is the output if the user enters 3 in response to the prompt?
Transcribed Image Text:
import java.util. Scanner; public class Athletes { public static void main(String[] args) { Scanner stdIn String[] players {"Serena Williams", "Alex Morgan", " Allyson Felix", "Lindsey Vonn", "Katie Ledecky"}; String ranking; int index = 0; index = System.out.print("Enter ranking: "); ranking = stdIn.nextLine(); try { = new Scanner(System.in); = } try { Integer.parseInt (ranking); System.out.println("Rank "1 } catch (Number Format Exception e) { + index); System.out.println("Entered value must be an integer."); System.out.println(players[index 1]); } catch (Index OutOfBounds Exception e) { System.out.println("Entry must be between 1 and + players. length); "1
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (QA)
The provided Java program defines a class Athletes with a main method that executes several operatio...View the full answer
Answered By
Cyrus Sandoval
I a web and systems developer with a vast array of knowledge in many different front end and back end languages, responsive frameworks, databases, and best code practices. My objective is simply to be the best web developer that i can be and to contribute to the technology industry all that i know and i can do. My skills include:
- Front end languages: css, HTML, Javascript, XML
- Frameworks: Angular, Jquery, Bootstrap, Jasmine, Mocha
- Back End Languages: Java, Javascript, PHP,kotlin
- Databases: MySQL, PostegreSQL, Mongo, Cassandra
- Tools: Atom, Aptana, Eclipse, Android Studio, Notepad++, Netbeans.
Having a degree in Computer Science enabled me to deeply learn most of the things regarding programming, and i believe that my understanding of problem solving and complex algorithms are also skills that have and will continue to contribute to my overall success as a developer.
I’ve worked on countless freelance projects and have been involved with a handful of notable startups. Also while freelancing I was involved in doing other IT tasks requiring the use of computers from working with data, content creation and transcription.
5.00+
1+ Reviews
10+ Question Solved
Related Book For
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean
Question Posted:
Students also viewed these Computer science questions
-
For the program in Exercise 1, what is the output if the user enters first in response to the prompt? Exercise 1 Given the program below, what is the output if the user enters 3 in response to the...
-
In this assignment, you are writing a program that converts common texting abbreviations to English words to allow people like yours truly can understand. For the assignment, you are provided with a...
-
Anne Sugar makes large ceramic pots for use in outdoor landscaping. She currently has two models, one square and the other round. Because of the size of Anne's creations, only one pot can be fired in...
-
If M is the midpoint of XY, find the coordinates of Y when X and M have the following coordinates: X(-4,2), M(0,3) Please write formulas too
-
The persistent messaging scheme described in this chapter depends on timestamps combined with discarding of received messages if they are too old. Suggest an alternative scheme based on sequence...
-
The number of automobiles that arrive at a certain intersection per minute has a Poisson distribution with a mean of 5. Interest centers around the time that elapses before 10 automobiles appear at...
-
Regarding the recent advances in drilling technologies that permit natural gas to be recovered from shale deposits cost competitively, present arguments from an environmental perspective in favor and...
-
IT auditors need people skills as well as technical skills. One such skill is the ability to interview effectively. Discuss some techniques or tools that might help an interviewer get the best...
-
Explain (with examples if possible) the difference between competitive isomorphism, "Best - fit" or contingency approach to HRM, and the resource based view of the firm.
-
Explain what the following program does for different possible user inputs. import java.util.Scanner; import java.util. InputMismatch Exception; public class Guess { public static void main(String[]...
-
The JVM will close your file automatically if you instantiate its file handler in a try-with-resources header, like this (T / F): public void writeToFile(String filename, String text) throws...
-
Compute the gradient of the following functions and evaluate it at the given point P. h(x, y) = ln (1 + x + 2y); P(2, -3)
-
Which impact does the priority inversion problem have on the design of network middleware?
-
Provide an overview over techniques for taking advantage of scratch pad memories!
-
Provide an example demonstrating priority inversion for a system comprising three jobs!
-
How could flash memory have an influence on the design of real-time databases?
-
Which components do FPGAs comprise? Which of these are used to implement Boolean functions? How are FPGAs configured? Are FPGAs energy-efficient? Which kind of applications are FPGAs good for?
-
List the seven types of cohesion. Why do the various types of cohesion range from good to bad? Give an example of good coupling and an example of bad coupling.
-
The process of collaborative goal setting by a manager and subordinate, the extent to which goals are accomplished is a major factor in evaluating and rewarding the subordinate's performance. It is...
-
Tiffany Campbell is the cost accountant in a small manufacturing company, Computer Components, Inc. (CC). CC produces components for one of the large computer manufacturers. Its strategy is to...
-
How do employee ownership and employee empowerment help in increasing employee motivation and satisfaction?
-
From where do mantle plumes derive their heat?
-
Identify two industries of intermediate goods that are complementary to each other in the Philippines, and explain why these two goods are (1) Intermediate goods and (2) complementary goods to each...
-
Kevin is a factory supervisor, and he is currently preparing the production budget for the next quarter. The following production budget was in place for the current quarter of the year: January 560...
-
What theory or theories, if any, can Paul assert for products liability against: Designer? DreamBike Manufacturing? Dealer?
Study smarter with the SolutionInn App