4. This question involves the process of taking a list of words, called wordList, and producing a formatted string of a specified length. The list wordList contains at least two words, consisting of letters only. When the formatted string is constructed, spaces are placed in the gaps between words so that as many spaces as possible are evenly distributed to each gap. The equal number of spaces inserted into each gap is referred to as the basic gap width. Any leftover spaces are inserted one at a time into the gaps from left to right until there are no more leftover spaces. The following three examples illustrate these concepts. In each example, the list of words is to be placed into a formatted string of length 20. Example 1: wordList: ["AP", Total number of letters in words: 14 Number of gaps between words: 3 Basic gap width: 2 Leftover spaces: 0 Formatted string: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |A|P| | |C|O|M|P| | |S|C|1| | |R|O|C|K|S| с I Example 2: wordList: ["GREEN", "EGGS", "AND", "HAM"] Total number of letters in words: 15 Number of gaps between words: 3 Basic gap width: 1 Leftover spaces: 2 The leftover spaces are inserted one at a time between the words from left to right until there are no more leftover spaces. In this example, the first two gaps get an extra space. Formatted string: 0 1 2 3 4 G R E E N Formatted string: 012 3 4 A с H "COMP", "SCI", "ROCKS"] 5 B 6 Example 3: wordList: ["BEACH", "BALL"] Total number of letters in words: 9 Number of gaps between words: 1 Basic gap width: 11 Leftover spaces: 0 7 E 8 9 10 11 12 13 14 15 16 17 18 19 A N D G G S H A M 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 B 3|A|1 L L You will implement three static methods in a class named StringFormatter that is not shown.
4. This question involves the process of taking a list of words, called wordList, and producing a formatted string of a specified length. The list wordList contains at least two words, consisting of letters only. When the formatted string is constructed, spaces are placed in the gaps between words so that as many spaces as possible are evenly distributed to each gap. The equal number of spaces inserted into each gap is referred to as the basic gap width. Any leftover spaces are inserted one at a time into the gaps from left to right until there are no more leftover spaces. The following three examples illustrate these concepts. In each example, the list of words is to be placed into a formatted string of length 20. Example 1: wordList: ["AP", Total number of letters in words: 14 Number of gaps between words: 3 Basic gap width: 2 Leftover spaces: 0 Formatted string: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |A|P| | |C|O|M|P| | |S|C|1| | |R|O|C|K|S| с I Example 2: wordList: ["GREEN", "EGGS", "AND", "HAM"] Total number of letters in words: 15 Number of gaps between words: 3 Basic gap width: 1 Leftover spaces: 2 The leftover spaces are inserted one at a time between the words from left to right until there are no more leftover spaces. In this example, the first two gaps get an extra space. Formatted string: 0 1 2 3 4 G R E E N Formatted string: 012 3 4 A с H "COMP", "SCI", "ROCKS"] 5 B 6 Example 3: wordList: ["BEACH", "BALL"] Total number of letters in words: 9 Number of gaps between words: 1 Basic gap width: 11 Leftover spaces: 0 7 E 8 9 10 11 12 13 14 15 16 17 18 19 A N D G G S H A M 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 B 3|A|1 L L You will implement three static methods in a class named StringFormatter that is not shown.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
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 now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education