Write a program 1. Generate a random number between 3 and 6 words to ask for...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program 1. Generate a random number between 3 and 6 words to ask for 2. Display: I'll need [number] words: that does the following: 3. Proceed to ask for each word, one at a time: Word #[number] please > 4. At the end, your program should print out : (a) the longest word (the most recently entered longest if there is a tie) (b) the shortest word (the most recently entered shortest if there is a tie) (c) the average length of all of the words (up to the second decimal point) Longest: program Average Length: 4.75 , inclusive - this will determine how many Sample examples (the user input is in red, the printed output is in blue, and the prompt is in black): I'll need 4 words: Word #1 please > wow Word #2 please > oh I'll need 3 words: Word #1 please > hi Word #2 please > hi Word #3 please > hi Shortest: hi Word #3 please > amazing Word #4 please > program Shortest: oh Longest: hi Average Length: 2.00 I'll need 5 words: Word #1 please > hello Word #2 please > computer Word #3 please > python Word #4 please > world Word # 5 please > homework Shortest: world Longest: homework Average Length: 6.40 Write a program 1. Generate a random number between 3 and 6 words to ask for 2. Display: I'll need [number] words: that does the following: 3. Proceed to ask for each word, one at a time: Word #[number] please > 4. At the end, your program should print out : (a) the longest word (the most recently entered longest if there is a tie) (b) the shortest word (the most recently entered shortest if there is a tie) (c) the average length of all of the words (up to the second decimal point) Longest: program Average Length: 4.75 , inclusive - this will determine how many Sample examples (the user input is in red, the printed output is in blue, and the prompt is in black): I'll need 4 words: Word #1 please > wow Word #2 please > oh I'll need 3 words: Word #1 please > hi Word #2 please > hi Word #3 please > hi Shortest: hi Word #3 please > amazing Word #4 please > program Shortest: oh Longest: hi Average Length: 2.00 I'll need 5 words: Word #1 please > hello Word #2 please > computer Word #3 please > python Word #4 please > world Word # 5 please > homework Shortest: world Longest: homework Average Length: 6.40
Expert Answer:
Answer rating: 100% (QA)
It seems you have shared an image that illustrates a sample interaction with a program that asks use... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Genos Restaurant has a dress policy that requires female servers to wear a uniform provided by the restaurant, but male servers are simply told to wear black shirts and blank slacks. The uniforms...
-
A vessel is in the form of an inverted cone. Its height is 8 cm and the radius of its top, which is open, is 5 cm. It is filled with water up to the brim. When lead shots, each of which is a sphere...
-
Find vC(t) for t > 0 in the circuit in Fig. P6.65. t=0 iL 1 1H 1A
-
In Exercises find the points of horizontal and vertical tangency (if any) to the polar curve. r = 1 - cos
-
How many states are in the \(l=4\) subshell? A. 8 B. 9 C. 16 D. 18 E. 22
-
Unique Exclusive sells antiques to discerning clients. The business has developed the following business objectives: 1. To buy only the antiques that sell 2. To have repeat customers 3. To be...
-
Angela Lopez owns and manages a consulting firm called Metrix, which began operations on December 1. On December 31, Metrix shows the following selected accounts and amounts for the month of...
-
The owner has decided to transfer a large shelving unit he owns privately to the business to be used as display shelving in the shop. The asset is to be transferred on the 30 June 2022 at its current...
-
Augustine Goh was born on 17 December 1980 in Singapore. During the calendar year ended 31 December 2020, he decided to be a private-hire car driver after being jobless for so long. On 1 April 2020,...
-
According to Plato in the Timaeus , the universe was patterned after the Form World Soul . The Universe was created by the Demiurge , a divine force referred to as the " father of heaven who is past...
-
A parking lot has the capacity of 10 cars. Each car stays in the parking lot 1 hour on average. The mean time between car arrivals is 30 minutes. If the parking lot is full, a newly arrived car does...
-
Jens just took out a loan from the bank for 59,516 dollars. He plans to repay this loan by making a special payment to the bank of 5,460 dollars in 3 years and by also making equal, regular annual...
-
Jill, being very smart, puts $400 per month in her retirement account at the end of each month. This account earns on average 12% annual interest on the amount in her account. The interest is...
-
Linda wants to retire in 27 years with $2,000,000 in her IRA. She plans to invest $20,000 a year into the account until she retires. About what rate of interest must Linda earn on the IRA to meet her...
-
The table below gives the growth statistics for the USA in the last 15 years. Output per worker hour Capital Stock per worker Labor Supply Labor share in earnings Growth Rate (% per year) 1.23% 0.83%...
-
Don Griffin worked as an accountant at a local accounting firm for five years after graduating from university. Recently, he opened his own accounting practice, which he operates as a corporation....
-
Programming Exercise 22.12 retrieves the last 100 prime numbers from a file PrimeNumbers.dat. Write a client program that requests the server to send the last 100 prime numbers in an array. Name the...
-
Listing 8.4 checks whether a solution is valid by checking whether every number is valid in the board. Rewrite the program by checking whether every row, every column, and every small box has the...
-
Add a method in the BST class to return the number of the nonleaves as follows: /** Returns the number of nonleaf nodes */ public int getNumberofNonLeaves()
-
The latent heat of vaporization per unit mass of a pure substance at a given temperature, \(\lambda\), is defined as the difference in enthalpy between the saturated vapor and saturated liquid at the...
-
Air at \(345 \mathrm{~K}\) has a dew-point temperature of \(312 \mathrm{~K}\). Calculate the absolute and relative humidity, and the enthalpy of the mixture relative to liquid water and air at \(273...
-
It is desired to dehumidify \(1.2 \mathrm{~m}^{3} / \mathrm{s}\) of air, available at \(311 \mathrm{~K}\) with a wet-bulb temperature of \(303 \mathrm{~K}\), to a wet-bulb temperature of \(288...
Study smarter with the SolutionInn App