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: 25% (4 reviews)
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...
-
Stacey Weller, the accountant, is a perfectionist. No one can do the job as well as she can. Indeed, she has found budget information provided by the various departments to be worthless. She must...
-
The optical fiber in Figure P26.48 has a core of diameter 50 mm and a total diameter of 60 mm. The indices of refraction are n core = 1.65 and n cladding = 1.55. What is the maximum value of u in...
-
Compensation tied to Balanced Scorecard, degree of difficulty of target achievement Discuss Case 2-48.
-
Land O'Lakes Land O'akes' is comsidering processing its half \& half into two additional products - flavored half \& half and puese products is provided below
-
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...
-
In Problems 1528, find the area bounded by the graphs of the indicated equations over the given interval. Compute answers to three decimal places. y = -x + 10; y = 0; -3 x 3
-
firm c has net income of 45,360 , asset turnover of 1.4 and roi 12.6% calculate firms margin,sales and average total assets
-
A poll of 1065 Americans showed that 47.2% of the respondents prefer to watch the news rather than read or listen to it. Use those results with a 0.10 significance level to test the claim that fewer...
-
Garcia Industries uses a cost system that carries direct materials inventory at a standard cost. The controller has established these standards for the cost of one unit: Standard Quantity X Standard...
-
Express the confidence interval 0.255 0.046 in the form of p-E
-
5 28 its Jay Oullette, CEO of Bumper to Bumper Incorporated, anticipates that his company's year-end balance sheet will show current assets of $12,801 and current liabilities of $7,540. Oullette has...
-
The graph of the total revenue R(x) (in dollars) from the sale of x cordless electric screwdrivers is shown in the figure. (A) Write a brief description of the graph of the marginal revenue function...
-
Consider the advantages and disadvantages of extending property rights so that everyone would have the right to prevent people imposing any costs on them whatsoever (or charging them to do so).
-
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?
-
Which of the following journal entries will record the payment of a $1,500 salaries payable originally incurred for Salaries Expense? Select one: A. Debit Salaries Expense; credit Salaries Payable B....
-
What is the definition of substantially appreciated inventory? A. Inventory with a FMV greater than its basis B. Inventory and unrealized receivables with a FMV greater than their basis C. Inventory...
-
Case Products manufactures two models of DVD storage cases: regular and deluxe. Presented is standard cost information for each model: Cost Components Regular Deluxe Direct materials Lumber 2 board...
Study smarter with the SolutionInn App