006_PartyPooper.java X PrintDemojava X Passwordoenerator.java X IntegerName.java x Grades.ja import java.util.Arrays; public class CopyHalf /** Copies the first half of an array. If the length is odd, don't copy the middle value. Gparan values an array Greturn a copy of the first half of values */ public static /* Your code goes here */ copyHalf(String() yalves) /* Your code goes here */ public static void main(String[] args) String() arri = { "Hary", "had", "a", "little", "Lamb" }; System.out.println("Full Array 1: " + Arrays.tostring(arr1)); System.out.println("Half Array 1: + Arrays.tostring(copyHalf(arr1))); System.out.println(); String() arr2 = { "its", "fleece", "was", "white", "as", "snow" }; System.out.println("Full Array 2: System.out.println("Half Array 2: I + Arrays.tostring(arr2)); + Arrays.toString(copyHalf(arr2)));

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter16: Graphics
Section: Chapter Questions
Problem 1DE
icon
Related questions
Question
Complete the following code to make a copy of the first half of an array of strings. Only edit code within the /* Your code goes here */ portions
re) G CopyHalf
Prog06_PartyPooper.java x
G PrintDemojava X
PasswordGenerator.java x
G G
IntegerName.java x
Grades.java X
test.lava X
G ArrayDe
import java.util. Arrays;
1350 -/ldeaP 1
dea
2
3
public class CopyHalf
ut
4
{
BArrayDemo
白
/**
Boxes
Copies the first half of an array. If the length is odd,
Compare2
3 CopyHalf
7
don't copy the middle value.
@param values an array
GCubes
@return a copy of the first half of values
G DoLoop
G Doublelnvest 10
G DuplicatedCh 11
GEarthquakeSt 12
G ElevatorSimul 13
9
*/
public static /* Your code goes here */ copyHalf(String[) yalues)
{
/* Your code goes here */
G Errort
G Error2
G Error3
14
15
16
public static void main(String[) args)
O FindSpaces
FirstVowel.jav
18
17
{
String[] arr1 = { "Mary", "had", "a", "little", "lamb" };
System.out.println("Full Array 1: " + Arrays.toString(arr1));
System.out.println("Half Array 1: " + Arrays.toString(copyHalf(arr1)));
G Geometry
G Grades
19
G HelloPrinter 20
G IntegerName 21
G InvestmentTal 22
System.out.println();
l joh661.zip
23
O Numbers
String(] arr2 = { "its", "fleece", "was", "white", "as", "snow" };
System.out.println("Full Array 2: " + Arrays.toString(arr2));
System.out.println("Half Array 2: " + Arrays.toString(copyHalf(arr2)));
I
24
G PasswordGen
25
G PowerTable
26
G PrintDemo
G PrintTableDer 27
Prog06_Party
28
G Pyramids
G RandomDemd
Read Time
O ArrayDemo x
ZUsers/jacobjohnston/Library/Java/JavaVirtvalMachines/openidk-16.0.2/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDE
个
0 246 8
Fred Amy Cindy Henry
42 2 4 6 8
巴
Enter scores, -1 to quit:
12 25 20 0 10 -1
You entered the following scores:
12 25 20 e 10
Process finished with exit code 0
Run
E TODO
O Problems
2 Terminal
K Build
files are up-to-date (10/30/21, 2:15 PM)
MacBook Pro
Transcribed Image Text:re) G CopyHalf Prog06_PartyPooper.java x G PrintDemojava X PasswordGenerator.java x G G IntegerName.java x Grades.java X test.lava X G ArrayDe import java.util. Arrays; 1350 -/ldeaP 1 dea 2 3 public class CopyHalf ut 4 { BArrayDemo 白 /** Boxes Copies the first half of an array. If the length is odd, Compare2 3 CopyHalf 7 don't copy the middle value. @param values an array GCubes @return a copy of the first half of values G DoLoop G Doublelnvest 10 G DuplicatedCh 11 GEarthquakeSt 12 G ElevatorSimul 13 9 */ public static /* Your code goes here */ copyHalf(String[) yalues) { /* Your code goes here */ G Errort G Error2 G Error3 14 15 16 public static void main(String[) args) O FindSpaces FirstVowel.jav 18 17 { String[] arr1 = { "Mary", "had", "a", "little", "lamb" }; System.out.println("Full Array 1: " + Arrays.toString(arr1)); System.out.println("Half Array 1: " + Arrays.toString(copyHalf(arr1))); G Geometry G Grades 19 G HelloPrinter 20 G IntegerName 21 G InvestmentTal 22 System.out.println(); l joh661.zip 23 O Numbers String(] arr2 = { "its", "fleece", "was", "white", "as", "snow" }; System.out.println("Full Array 2: " + Arrays.toString(arr2)); System.out.println("Half Array 2: " + Arrays.toString(copyHalf(arr2))); I 24 G PasswordGen 25 G PowerTable 26 G PrintDemo G PrintTableDer 27 Prog06_Party 28 G Pyramids G RandomDemd Read Time O ArrayDemo x ZUsers/jacobjohnston/Library/Java/JavaVirtvalMachines/openidk-16.0.2/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDE 个 0 246 8 Fred Amy Cindy Henry 42 2 4 6 8 巴 Enter scores, -1 to quit: 12 25 20 0 10 -1 You entered the following scores: 12 25 20 e 10 Process finished with exit code 0 Run E TODO O Problems 2 Terminal K Build files are up-to-date (10/30/21, 2:15 PM) MacBook Pro
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage