Question
Problem #2 (15 points): Replicating 2D arrays 1. Create a Java project named FirstName-LastName -HW7 . a. Add a new package named hw7p2 to the
Problem #2 (15 points): Replicating 2D arrays
1. Create a Java project named FirstName-LastName-HW7 . a. Add a new package named hw7p2 to the project.
Right click the package and add a new class named Clone without a main method.
Add another class named CloneTester with a main method.
2. Write a. The first method copies a two-dimensional array which is square (same number of rows
code for the Clone.java with three methods. and columns). Use the following array:
(attached in photo)
The second method copies a two-dimensional array which is rectangular (diffrent number of rows and columns). This method must work for 2D square array, too. Use the following array:
The third method copies a two-dimensional array which is ragged. This method must work for both 2D square and rectangular arrays. Use the following array:
(attached in photo)
3. Write a. Test each method.
code for the CloneTester.java. b. Test if the second method works for a 2D square array.
c. Test if the third method works for both 2D square and rectangular arrays.
LISTCONTENT.JAVA: package hw7p1; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Random; /************************************************************************ * Describe the purpose of this program here ************************************************************************/ public class ListContent { public static void main(String[] args) { /** * Need to explain why we need a final variable */ final int assumedLineLength = 16; /** * explain the code block below focusing on purpose (1 point) */ File file = new File("src/hw7p1/Acronyms.txt"); ListcontentList = new ArrayList ((int)(file.length() / assumedLineLength) * 2); /** * Need to explain the code block below focusing on purpose */ BufferedReader reader = null; int lineCount = 0; try { reader = new BufferedReader(new FileReader(file)); for (String eachLine = reader.readLine(); eachLine != null; eachLine = reader.readLine()) { contentList.add(eachLine); lineCount++; } } catch (IOException e) { System.err.format("Could not read %s: %s%n", file, e); System.exit(1); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { System.err.println(e.getMessage()); } } } /** * Need to explain the code block below focusing on purpose */ int numLinesToPrint = Integer.parseInt("20"); Random random = new Random(); for (int i = 0; i ACRONYMS:
A01 Web app A02 Engagement A03 Embedding A04 Impressions A05 Influencer A06 Mention A07 Microblogging A08 Organic A09 Reach A10 Social graph A11 User-generated content A12 Affiliate marketing A13 Bounce rate A14 Call to Action A15 Click through rate A16 Funnel A17 Impression A18 Keyword A19 Marketing automation A20 Multichannel A21 Search engine marketing A22 SEO: Search Engine Optimization A23 Traffic A24 A/B testing A25 Content marketing A26 Conversion A27 Data mining A28 Email marketing A29 Growth hacking A30 Optimization A31 Color value A32 Colory theory A33 Grid system A34 PPI A35 Raster A36 Resolution A37 Retina display A38 Vector A39 Mood board A40 Sitemap A41 UI A42 User flow A43 User persona A44 User research A45 UX A46 Wireframe A47 Font A48 Kerning A49 Leading A50 Typeface or Font family A51 Type hierarchy A52 Serif A53 Front end A54 Attribute A55 Element A56 HTML A57 HTML5 A58 Meta elements A59 Opening tag & Closing tag A60 Self-closing tag A61 Semantic element A62 Structural element A63 CSS A64 CSS3 A65 Declaration A66 Property A67 Selector A68 Value A69 API A70 Application A71 Back end A72 Bug A73 DevOps A74 Framework A75 Object-oriented programming A76 Software A77 Text editor A78 Version control A79 Web server A80 Caching A81 Cloud computing A82 Firewall A83 Router A84 Uptime & downtime A85 Virtual Machine (VM) A86 VPN Virtual Private Network A87 Big data A88 Data architecture A89 Database A90 Data modelling A91 Data visualization A92 Relational database management system A93 Hybrid app A94 IDE A95 Native app A96 NFC A97 Responsive A98 SDK A99 Content curationID ay17.moodle.umn.edu New Youth Beware ? PRG420 Course: F https:lay17 Chega 1 2 3 45 6 7 89 10 11 12 13 1415 16 17 18 19 20 21 22 23 24 25 262728 29 30 31 32 33 34 35 36 b. The second method copies a two-dimensional array which is rectangular (diffrent number of rows and columns). This method must work for 2D square array, too. Use the following array 1 23 4 5 6 78 9 10 11 12 13 1415 16 17 18 19 20 21 22 23 24 25 262728 29 30 The third method copies a two-dimensional array which is ragged. This method must work for both 2D square and rectangular arrays. Use the following array: c. 1 23 4 5 6 7 8 9 10 11 12 13 14 15 16 19 20 21222324 25 26 27 28 29
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started