0% found this document useful (0 votes)
12 views2 pages

Unit 6_ Lesson 5 - Coding Activity 1

The document outlines a coding activity where students must debug a reverse method in the U6_L5_Activity_One class to print strings from an array backwards. It specifies the use of an enhanced for loop and instructs students to use a runner class for testing without adding a main method. A sample run is provided to illustrate the expected output format.

Uploaded by

clwarren2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Unit 6_ Lesson 5 - Coding Activity 1

The document outlines a coding activity where students must debug a reverse method in the U6_L5_Activity_One class to print strings from an array backwards. It specifies the use of an enhanced for loop and instructs students to use a runner class for testing without adding a main method. A sample run is provided to illustrate the expected output format.

Uploaded by

clwarren2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

3/29/25, 12:33 PM Unit 6: Lesson 5 - Coding Activity 1

Unit 6: Lesson 5 - Coding Activity 1

Due No Due Date Points 1 Submitting an external tool

Instructions
Debug the reverse method code in the U6_L5_Activity_One class, which is intended to print
each String from a parameter array backwards on a new line. Unlike the reverse method you
wrote in lesson 3, this method uses an enhanced for loop to iterate through the array.

Use the runner class to test this method: do not add a main method to your code in the
U6_L5_Activity_One.java file or it will not be scored correctly.

Sample run (runner class):

Enter array length:


4

Enter values:
hill
mold
tree
lake
llih
dlom
eert
ekal

https://courses.projectstem.org/courses/166695/assignments/19187337?module_item_id=36946628 1/2
3/29/25, 12:33 PM Unit 6: Lesson 5 - Coding Activity 1

Files NOT SUBMITTED

STATUS
RESET SAVE
INSTRUCTIONS RUN CODE GRADING HISTORY
1 public class U6_L5_Activity_One
2 {
U6_L5_Activity_One.java 3 RUN CODE CL
4 public static void reverse(String[] wo
5 {
runner_U6_L5_Activity_… 6 for(String s ; words)
7 { ERROR
8 for(int i = words[s].length() - 1;
9 { /tmp/sub-
10 System.out.print(words.substring
11 } 3585268801/U6_L5_Activity_
12 System.out.println(); error: ';' expected
13 } for(String s ; words)
14 }
15 ^
16 } 1 error

https://courses.projectstem.org/courses/166695/assignments/19187337?module_item_id=36946628 2/2

You might also like