SlideShare uma empresa Scribd logo
1 de 2
Baixar para ler offline
1. In IntelliJ, navigate to the Labs package and create another package named Lab8. 2. Create a
class in the Lab8 package called Array. Java with a ma in method that will do the following:
(Note: Document your algorithm as comments near related lines of code) a. Input at the
command line the following String: "Beth,Rick,Jerry,Rick, Summer,Morty" (DON"T type the
"".) i. Step 1: Go to Run Edit Configurations ii. Step 2: Go to Application, you might need to use
the + key to find it, and add the program arguments needed. This will allow that string to be
entered into the program when it is run. This string will be stored in the String[ args array in the
0 position. b. Use this inputted String and the method .split (,") to create an array of String
objects called tokens. The actual code you will use is below:
This will allow that string to be entered into the program when it is run. This string will be stored
in the String[] args array in the 0 position. b. Use this inputted String and the method .split (",")
to create an array of String objects called tokens. The actual code you will use is below:
String[]tokens=args[0].split(","); c. Create another String array called customerName. This array
will have eight String objects. d. Create a for loop to copy each element in the tokens array into
the customerName array. A this point the last two positions in the tokens array will be null. e.
Write a method, displayNames0, to display the names within the array. You will pass the String
array, customerName to the method. The method will then use a foreach loop (aka an enhanced
for loop) to display the array of names so that each name is on a separate line. End your output
with a blank line. Here is the method header: public static void displayNames (String [] names)
Answer the following questions as comment lines in your code: - What is displayed for the last
two array clements? - Why is it that value?
e. Write a method, displayNames0, to display the names within the array. You will pass the
String array, customerName to the method. The method will then use a foreach loop (aka an
enhanced for loop) to display the array of names so that each name is on a separate line. End
your output with a blank line. Here is the method header: public static void displayNames
(String[] names) Answer the following questions as comment lines in your code: - What is
displayed for the last two array elements? - Why is it that value? Make a call to displayNames in
your main method. f. Move the existing elements from indexes 4 and 5 to indices 6 and 7
respectively. You can then ad the Strings "Rick" and "Jessica" into index 4, and 5, respectively.
The array should tiven contain the following elements in this order: g. Call the displayNames 0
method again (2nd time) to output the customerNames array.
h. Write a method to reverse the elements in the array. You will pass in the customerName array
to this method and will return a new array with the elements reversed. Here is the method header:
public static String [] reverseNames (String [] names) Answer the following question: - Is there a
way to simplify this method so that you do not need to return an array? i. Call the displayNames
0 method (3rd time) to output the names in the array that was returned in Step h. j. Write another
method to reverse the elements in the customerNames array without creating a new array. You
will pass in the customerName array to this method and will switch the elements of this array
around so that the elements reversed. Hint: Think about this switching. How many switches do
you need to make? Do you need to walk through the entire array? Here is the method header:
public static void reverseNames2(String[1 names) k. Write a traditional for loop that checks each
element for the String "Rick", if found in the array, remove it, shift the remaining elements up,
leaving null at the last position.
entire array? Here is the method header: public static void reverseNames2 (String[] names) k.
Write a traditional for loop that checks each element for the String "Rick", if found in the array,
remove it, shift the remaining elements up, leaving null at the last position. Note: You will fill in
the last element of the array with the value of null, with no quotes, after shifting the elements up.
You will also have to check that the customerName[i] != null before seeing if the value of
customerName[i].equals("Rick"). 1. Call the displayNames 0 method (4th time) again to output
the customerNames array. m. Answer these questions: - Are all instances of "Rick" removed
correctly from the array? Why or why not? Can you explain what you observe in your code?
Why do you still have one "Rick" or how did you adjust your algorithm to not have a remaining
"Rick"? n. Adjust your code to shift elements if necessary to remove all the Ricks 3. Run the
ArrayTest. java JUnit test cases to make sure each one passes. 4. Take a screenshot of the
ArrayTest. Java running showing that all test cases pass.

Mais conteúdo relacionado

Semelhante a 1. In IntelliJ, navigate to the Labs package and create another packa.pdf

Algorithms devised for a google interview
Algorithms devised for a google interviewAlgorithms devised for a google interview
Algorithms devised for a google interviewRussell Childs
 
(E Book) Asp .Net Tips, Tutorials And Code
(E Book) Asp .Net Tips,  Tutorials And Code(E Book) Asp .Net Tips,  Tutorials And Code
(E Book) Asp .Net Tips, Tutorials And Codesyedjee
 
Arrays.pptx
Arrays.pptxArrays.pptx
Arrays.pptxEpsiba1
 
Arrays in programming
Arrays in programmingArrays in programming
Arrays in programmingTaseerRao
 
ScalaLanguage_ch_4_5.pptx
ScalaLanguage_ch_4_5.pptxScalaLanguage_ch_4_5.pptx
ScalaLanguage_ch_4_5.pptxjkapardhi
 
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxmaxinesmith73660
 
Mcq 15-20Q15Which of the following trees are binary search tr
Mcq 15-20Q15Which of the following trees are binary search trMcq 15-20Q15Which of the following trees are binary search tr
Mcq 15-20Q15Which of the following trees are binary search trAbramMartino96
 
Array String - Web Programming
Array String - Web ProgrammingArray String - Web Programming
Array String - Web ProgrammingAmirul Azhar
 
Read carefully. Im not sure if the point class is correct but postin.pdf
Read carefully. Im not sure if the point class is correct but postin.pdfRead carefully. Im not sure if the point class is correct but postin.pdf
Read carefully. Im not sure if the point class is correct but postin.pdfbharatchawla141
 
CIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in JavaCIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in JavaHamad Odhabi
 
Please the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdfPlease the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdfadmin463580
 
Learn C# Programming - Nullables & Arrays
Learn C# Programming - Nullables & ArraysLearn C# Programming - Nullables & Arrays
Learn C# Programming - Nullables & ArraysEng Teong Cheah
 
Objectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdfObjectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdffcsondhiindia
 

Semelhante a 1. In IntelliJ, navigate to the Labs package and create another packa.pdf (18)

Imp_Points_Scala
Imp_Points_ScalaImp_Points_Scala
Imp_Points_Scala
 
C# p9
C# p9C# p9
C# p9
 
Algorithms devised for a google interview
Algorithms devised for a google interviewAlgorithms devised for a google interview
Algorithms devised for a google interview
 
(E Book) Asp .Net Tips, Tutorials And Code
(E Book) Asp .Net Tips,  Tutorials And Code(E Book) Asp .Net Tips,  Tutorials And Code
(E Book) Asp .Net Tips, Tutorials And Code
 
Arrays.pptx
Arrays.pptxArrays.pptx
Arrays.pptx
 
Arrays in programming
Arrays in programmingArrays in programming
Arrays in programming
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
ScalaLanguage_ch_4_5.pptx
ScalaLanguage_ch_4_5.pptxScalaLanguage_ch_4_5.pptx
ScalaLanguage_ch_4_5.pptx
 
611+tutorial
611+tutorial611+tutorial
611+tutorial
 
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
 
Mcq 15-20Q15Which of the following trees are binary search tr
Mcq 15-20Q15Which of the following trees are binary search trMcq 15-20Q15Which of the following trees are binary search tr
Mcq 15-20Q15Which of the following trees are binary search tr
 
Array String - Web Programming
Array String - Web ProgrammingArray String - Web Programming
Array String - Web Programming
 
Read carefully. Im not sure if the point class is correct but postin.pdf
Read carefully. Im not sure if the point class is correct but postin.pdfRead carefully. Im not sure if the point class is correct but postin.pdf
Read carefully. Im not sure if the point class is correct but postin.pdf
 
CIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in JavaCIS 1403 lab 3 functions and methods in Java
CIS 1403 lab 3 functions and methods in Java
 
Please the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdfPlease the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdf
 
Learn C# Programming - Nullables & Arrays
Learn C# Programming - Nullables & ArraysLearn C# Programming - Nullables & Arrays
Learn C# Programming - Nullables & Arrays
 
Objectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdfObjectives 1. using indirect addressing 2. passing parameters.pdf
Objectives 1. using indirect addressing 2. passing parameters.pdf
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 

Mais de alokopticalswatchco0

1. Los usuarios externos de informaci�n de contabilidad financiera i.pdf
1. Los usuarios externos de informaci�n de contabilidad financiera i.pdf1. Los usuarios externos de informaci�n de contabilidad financiera i.pdf
1. Los usuarios externos de informaci�n de contabilidad financiera i.pdfalokopticalswatchco0
 
1. Para cada uno de los siguientes, inserte una o m�s letras may�scu.pdf
1. Para cada uno de los siguientes, inserte una o m�s letras may�scu.pdf1. Para cada uno de los siguientes, inserte una o m�s letras may�scu.pdf
1. Para cada uno de los siguientes, inserte una o m�s letras may�scu.pdfalokopticalswatchco0
 
1. only extrachromosomal ribosomal DNA circles are not transmitted f.pdf
1. only extrachromosomal ribosomal DNA circles are not transmitted f.pdf1. only extrachromosomal ribosomal DNA circles are not transmitted f.pdf
1. only extrachromosomal ribosomal DNA circles are not transmitted f.pdfalokopticalswatchco0
 
1. La radiaci�n solar consiste en ondas principalmente en el longi.pdf
1. La radiaci�n solar consiste en ondas principalmente en el longi.pdf1. La radiaci�n solar consiste en ondas principalmente en el longi.pdf
1. La radiaci�n solar consiste en ondas principalmente en el longi.pdfalokopticalswatchco0
 
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdfalokopticalswatchco0
 
1. Mark presents a five-year vision to his team that focuses on fina.pdf
1. Mark presents a five-year vision to his team that focuses on fina.pdf1. Mark presents a five-year vision to his team that focuses on fina.pdf
1. Mark presents a five-year vision to his team that focuses on fina.pdfalokopticalswatchco0
 
1. Los GAAP requieren que cierta informaci�n actuarial para las pens.pdf
1. Los GAAP requieren que cierta informaci�n actuarial para las pens.pdf1. Los GAAP requieren que cierta informaci�n actuarial para las pens.pdf
1. Los GAAP requieren que cierta informaci�n actuarial para las pens.pdfalokopticalswatchco0
 
1. Los elementos de la estrategia de Hershey Company han evolucionad.pdf
1. Los elementos de la estrategia de Hershey Company han evolucionad.pdf1. Los elementos de la estrategia de Hershey Company han evolucionad.pdf
1. Los elementos de la estrategia de Hershey Company han evolucionad.pdfalokopticalswatchco0
 
1. Los peces lech�n viven en el oc�ano. Estos peces se adhieren a la.pdf
1. Los peces lech�n viven en el oc�ano. Estos peces se adhieren a la.pdf1. Los peces lech�n viven en el oc�ano. Estos peces se adhieren a la.pdf
1. Los peces lech�n viven en el oc�ano. Estos peces se adhieren a la.pdfalokopticalswatchco0
 
1. List two of the major causes of habitat loss today.2. List tw.pdf
1. List two of the major causes of habitat loss today.2. List tw.pdf1. List two of the major causes of habitat loss today.2. List tw.pdf
1. List two of the major causes of habitat loss today.2. List tw.pdfalokopticalswatchco0
 
1. Los candidatos de trabajo m�s exitosos usan redes para encontrar .pdf
1. Los candidatos de trabajo m�s exitosos usan redes para encontrar .pdf1. Los candidatos de trabajo m�s exitosos usan redes para encontrar .pdf
1. Los candidatos de trabajo m�s exitosos usan redes para encontrar .pdfalokopticalswatchco0
 
1. Los Criterios de Daubert hacen preguntas espec�ficas sobre la adm.pdf
1. Los Criterios de Daubert hacen preguntas espec�ficas sobre la adm.pdf1. Los Criterios de Daubert hacen preguntas espec�ficas sobre la adm.pdf
1. Los Criterios de Daubert hacen preguntas espec�ficas sobre la adm.pdfalokopticalswatchco0
 
1. Las normas propuestas para implementar una ley son a. No est� a.pdf
1. Las normas propuestas para implementar una ley son a. No est� a.pdf1. Las normas propuestas para implementar una ley son a. No est� a.pdf
1. Las normas propuestas para implementar una ley son a. No est� a.pdfalokopticalswatchco0
 
1. La secci�n de activos de un balance general clasificado incluye .pdf
1. La secci�n de activos de un balance general clasificado incluye .pdf1. La secci�n de activos de un balance general clasificado incluye .pdf
1. La secci�n de activos de un balance general clasificado incluye .pdfalokopticalswatchco0
 
1. Las manos de un pastelero inoculan seis c�lulas de Staphylococcus.pdf
1. Las manos de un pastelero inoculan seis c�lulas de Staphylococcus.pdf1. Las manos de un pastelero inoculan seis c�lulas de Staphylococcus.pdf
1. Las manos de un pastelero inoculan seis c�lulas de Staphylococcus.pdfalokopticalswatchco0
 
1. Las siguientes son las etapas principales del proceso de compra e.pdf
1. Las siguientes son las etapas principales del proceso de compra e.pdf1. Las siguientes son las etapas principales del proceso de compra e.pdf
1. Las siguientes son las etapas principales del proceso de compra e.pdfalokopticalswatchco0
 
1. La madre A es Rh, mientras que el padre A es Rh+. �Cu�les son tod.pdf
1. La madre A es Rh, mientras que el padre A es Rh+. �Cu�les son tod.pdf1. La madre A es Rh, mientras que el padre A es Rh+. �Cu�les son tod.pdf
1. La madre A es Rh, mientras que el padre A es Rh+. �Cu�les son tod.pdfalokopticalswatchco0
 
1. La gente en general lleva una sola identidad. b una o quiz�s .pdf
1. La gente en general lleva una sola identidad. b una o quiz�s .pdf1. La gente en general lleva una sola identidad. b una o quiz�s .pdf
1. La gente en general lleva una sola identidad. b una o quiz�s .pdfalokopticalswatchco0
 
1. La fuente de carbono para la respiraci�n es... A.el sol B.agu.pdf
1. La fuente de carbono para la respiraci�n es... A.el sol B.agu.pdf1. La fuente de carbono para la respiraci�n es... A.el sol B.agu.pdf
1. La fuente de carbono para la respiraci�n es... A.el sol B.agu.pdfalokopticalswatchco0
 
1. La delimitaci�n entre negocios convencionales, negocios sociales .pdf
1. La delimitaci�n entre negocios convencionales, negocios sociales .pdf1. La delimitaci�n entre negocios convencionales, negocios sociales .pdf
1. La delimitaci�n entre negocios convencionales, negocios sociales .pdfalokopticalswatchco0
 

Mais de alokopticalswatchco0 (20)

1. Los usuarios externos de informaci�n de contabilidad financiera i.pdf
1. Los usuarios externos de informaci�n de contabilidad financiera i.pdf1. Los usuarios externos de informaci�n de contabilidad financiera i.pdf
1. Los usuarios externos de informaci�n de contabilidad financiera i.pdf
 
1. Para cada uno de los siguientes, inserte una o m�s letras may�scu.pdf
1. Para cada uno de los siguientes, inserte una o m�s letras may�scu.pdf1. Para cada uno de los siguientes, inserte una o m�s letras may�scu.pdf
1. Para cada uno de los siguientes, inserte una o m�s letras may�scu.pdf
 
1. only extrachromosomal ribosomal DNA circles are not transmitted f.pdf
1. only extrachromosomal ribosomal DNA circles are not transmitted f.pdf1. only extrachromosomal ribosomal DNA circles are not transmitted f.pdf
1. only extrachromosomal ribosomal DNA circles are not transmitted f.pdf
 
1. La radiaci�n solar consiste en ondas principalmente en el longi.pdf
1. La radiaci�n solar consiste en ondas principalmente en el longi.pdf1. La radiaci�n solar consiste en ondas principalmente en el longi.pdf
1. La radiaci�n solar consiste en ondas principalmente en el longi.pdf
 
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
1. Modify code to change cube into pyramid.2. Make the pyramid int.pdf
 
1. Mark presents a five-year vision to his team that focuses on fina.pdf
1. Mark presents a five-year vision to his team that focuses on fina.pdf1. Mark presents a five-year vision to his team that focuses on fina.pdf
1. Mark presents a five-year vision to his team that focuses on fina.pdf
 
1. Los GAAP requieren que cierta informaci�n actuarial para las pens.pdf
1. Los GAAP requieren que cierta informaci�n actuarial para las pens.pdf1. Los GAAP requieren que cierta informaci�n actuarial para las pens.pdf
1. Los GAAP requieren que cierta informaci�n actuarial para las pens.pdf
 
1. Los elementos de la estrategia de Hershey Company han evolucionad.pdf
1. Los elementos de la estrategia de Hershey Company han evolucionad.pdf1. Los elementos de la estrategia de Hershey Company han evolucionad.pdf
1. Los elementos de la estrategia de Hershey Company han evolucionad.pdf
 
1. Los peces lech�n viven en el oc�ano. Estos peces se adhieren a la.pdf
1. Los peces lech�n viven en el oc�ano. Estos peces se adhieren a la.pdf1. Los peces lech�n viven en el oc�ano. Estos peces se adhieren a la.pdf
1. Los peces lech�n viven en el oc�ano. Estos peces se adhieren a la.pdf
 
1. List two of the major causes of habitat loss today.2. List tw.pdf
1. List two of the major causes of habitat loss today.2. List tw.pdf1. List two of the major causes of habitat loss today.2. List tw.pdf
1. List two of the major causes of habitat loss today.2. List tw.pdf
 
1. Los candidatos de trabajo m�s exitosos usan redes para encontrar .pdf
1. Los candidatos de trabajo m�s exitosos usan redes para encontrar .pdf1. Los candidatos de trabajo m�s exitosos usan redes para encontrar .pdf
1. Los candidatos de trabajo m�s exitosos usan redes para encontrar .pdf
 
1. Los Criterios de Daubert hacen preguntas espec�ficas sobre la adm.pdf
1. Los Criterios de Daubert hacen preguntas espec�ficas sobre la adm.pdf1. Los Criterios de Daubert hacen preguntas espec�ficas sobre la adm.pdf
1. Los Criterios de Daubert hacen preguntas espec�ficas sobre la adm.pdf
 
1. Las normas propuestas para implementar una ley son a. No est� a.pdf
1. Las normas propuestas para implementar una ley son a. No est� a.pdf1. Las normas propuestas para implementar una ley son a. No est� a.pdf
1. Las normas propuestas para implementar una ley son a. No est� a.pdf
 
1. La secci�n de activos de un balance general clasificado incluye .pdf
1. La secci�n de activos de un balance general clasificado incluye .pdf1. La secci�n de activos de un balance general clasificado incluye .pdf
1. La secci�n de activos de un balance general clasificado incluye .pdf
 
1. Las manos de un pastelero inoculan seis c�lulas de Staphylococcus.pdf
1. Las manos de un pastelero inoculan seis c�lulas de Staphylococcus.pdf1. Las manos de un pastelero inoculan seis c�lulas de Staphylococcus.pdf
1. Las manos de un pastelero inoculan seis c�lulas de Staphylococcus.pdf
 
1. Las siguientes son las etapas principales del proceso de compra e.pdf
1. Las siguientes son las etapas principales del proceso de compra e.pdf1. Las siguientes son las etapas principales del proceso de compra e.pdf
1. Las siguientes son las etapas principales del proceso de compra e.pdf
 
1. La madre A es Rh, mientras que el padre A es Rh+. �Cu�les son tod.pdf
1. La madre A es Rh, mientras que el padre A es Rh+. �Cu�les son tod.pdf1. La madre A es Rh, mientras que el padre A es Rh+. �Cu�les son tod.pdf
1. La madre A es Rh, mientras que el padre A es Rh+. �Cu�les son tod.pdf
 
1. La gente en general lleva una sola identidad. b una o quiz�s .pdf
1. La gente en general lleva una sola identidad. b una o quiz�s .pdf1. La gente en general lleva una sola identidad. b una o quiz�s .pdf
1. La gente en general lleva una sola identidad. b una o quiz�s .pdf
 
1. La fuente de carbono para la respiraci�n es... A.el sol B.agu.pdf
1. La fuente de carbono para la respiraci�n es... A.el sol B.agu.pdf1. La fuente de carbono para la respiraci�n es... A.el sol B.agu.pdf
1. La fuente de carbono para la respiraci�n es... A.el sol B.agu.pdf
 
1. La delimitaci�n entre negocios convencionales, negocios sociales .pdf
1. La delimitaci�n entre negocios convencionales, negocios sociales .pdf1. La delimitaci�n entre negocios convencionales, negocios sociales .pdf
1. La delimitaci�n entre negocios convencionales, negocios sociales .pdf
 

Último

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 

Último (20)

YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 

1. In IntelliJ, navigate to the Labs package and create another packa.pdf

  • 1. 1. In IntelliJ, navigate to the Labs package and create another package named Lab8. 2. Create a class in the Lab8 package called Array. Java with a ma in method that will do the following: (Note: Document your algorithm as comments near related lines of code) a. Input at the command line the following String: "Beth,Rick,Jerry,Rick, Summer,Morty" (DON"T type the "".) i. Step 1: Go to Run Edit Configurations ii. Step 2: Go to Application, you might need to use the + key to find it, and add the program arguments needed. This will allow that string to be entered into the program when it is run. This string will be stored in the String[ args array in the 0 position. b. Use this inputted String and the method .split (,") to create an array of String objects called tokens. The actual code you will use is below: This will allow that string to be entered into the program when it is run. This string will be stored in the String[] args array in the 0 position. b. Use this inputted String and the method .split (",") to create an array of String objects called tokens. The actual code you will use is below: String[]tokens=args[0].split(","); c. Create another String array called customerName. This array will have eight String objects. d. Create a for loop to copy each element in the tokens array into the customerName array. A this point the last two positions in the tokens array will be null. e. Write a method, displayNames0, to display the names within the array. You will pass the String array, customerName to the method. The method will then use a foreach loop (aka an enhanced for loop) to display the array of names so that each name is on a separate line. End your output with a blank line. Here is the method header: public static void displayNames (String [] names) Answer the following questions as comment lines in your code: - What is displayed for the last two array clements? - Why is it that value? e. Write a method, displayNames0, to display the names within the array. You will pass the String array, customerName to the method. The method will then use a foreach loop (aka an enhanced for loop) to display the array of names so that each name is on a separate line. End your output with a blank line. Here is the method header: public static void displayNames (String[] names) Answer the following questions as comment lines in your code: - What is displayed for the last two array elements? - Why is it that value? Make a call to displayNames in your main method. f. Move the existing elements from indexes 4 and 5 to indices 6 and 7 respectively. You can then ad the Strings "Rick" and "Jessica" into index 4, and 5, respectively. The array should tiven contain the following elements in this order: g. Call the displayNames 0 method again (2nd time) to output the customerNames array. h. Write a method to reverse the elements in the array. You will pass in the customerName array to this method and will return a new array with the elements reversed. Here is the method header:
  • 2. public static String [] reverseNames (String [] names) Answer the following question: - Is there a way to simplify this method so that you do not need to return an array? i. Call the displayNames 0 method (3rd time) to output the names in the array that was returned in Step h. j. Write another method to reverse the elements in the customerNames array without creating a new array. You will pass in the customerName array to this method and will switch the elements of this array around so that the elements reversed. Hint: Think about this switching. How many switches do you need to make? Do you need to walk through the entire array? Here is the method header: public static void reverseNames2(String[1 names) k. Write a traditional for loop that checks each element for the String "Rick", if found in the array, remove it, shift the remaining elements up, leaving null at the last position. entire array? Here is the method header: public static void reverseNames2 (String[] names) k. Write a traditional for loop that checks each element for the String "Rick", if found in the array, remove it, shift the remaining elements up, leaving null at the last position. Note: You will fill in the last element of the array with the value of null, with no quotes, after shifting the elements up. You will also have to check that the customerName[i] != null before seeing if the value of customerName[i].equals("Rick"). 1. Call the displayNames 0 method (4th time) again to output the customerNames array. m. Answer these questions: - Are all instances of "Rick" removed correctly from the array? Why or why not? Can you explain what you observe in your code? Why do you still have one "Rick" or how did you adjust your algorithm to not have a remaining "Rick"? n. Adjust your code to shift elements if necessary to remove all the Ricks 3. Run the ArrayTest. java JUnit test cases to make sure each one passes. 4. Take a screenshot of the ArrayTest. Java running showing that all test cases pass.