Академический Документы
Профессиональный Документы
Культура Документы
2
Sections Lab Day DUE DATE
007 R 4/11/19
Purpose: To learn how to create, populate, and access arrays using value-
receiving and value-returning methods.
Lab Exercise 6.2 Instructions: Code a program that prompts the user for
the size of the array. Using the size, the program creates several arrays that
will store information about inventors and their inventions. There will be one
array for the inventor, another for the invention, and the last one for the year
of the invention. The values in each array at the same location are for a given
inventor. Once the arrays are populated, print the information from each
array. The size and input will be the only global variables. Use
printf(). Code your program according to the specifications below. Use the
looping structure generally associated with array processing. Name the
program YourLastNameFirstInitialLE62.java. The methods will be called from
the main().
© Linda Shepherd: LE 1
© https://science.howstuffworks.com/innovation/famous-inventors: Search by inventor.
array and populate it. The Xs in the prompt is the invention. The
setInventionYear method will return the year array to the calling statement as
well as receive the invention array from the calling statement. This method
will be called as an argument in the call to printInventions(). NOTE: The
invention in the prompt is ALL lowercase.
Output Specifications: Where the Xs represent the inventor and invention and
the Zs the year. Code the output print statement in a method named
printInventions() that accepts the inventors, and inventions arrays; and,
the year array as returned by setInventionYear(). In the printInventions
method use a for loop to print the information from each array. The print for
the header has to be outside of the for loop because it's printed only once.
FAMOUS INVENTIONS
Inventor: Xxxxxxxxxxxx
Invention: Xxxxxxxxxxxx
Year Invented: ZZZ9
Inventor: Xxxxxxxxxxxx
Invention: Xxxxxxxxxxxx
Year Invented: ZZZ9
Grading Requirements: During lab class, enter your name on the sign-up
sheet for grading when your assignment is in gradable condition.
© Linda Shepherd: LE 2
© https://science.howstuffworks.com/innovation/famous-inventors: Search by inventor.
****SAMPLE OUTPUT****
Enter the year in which the tin foil phonograph was invented: 1877
Enter the year in which the pomade from peanuts was invented: 1925
FAMOUS INVENTIONS
© Linda Shepherd: LE 3
© https://science.howstuffworks.com/innovation/famous-inventors: Search by inventor.