SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Based on how the value in some array position i compares to the value in its successor position i
+ 1, each position i in the array a is classified as an u pstep if a [i ] < a [i + 1], a d ownstep if a [i
] > a[ i + 1], and a plateau if a [ i ] == a [ i + 1]. The last position of the array has no such
classification, since there is no successor element that we could compare it with. write a method
with boolean sameStepShape(int[] a, int[] b) that checks whether the two parameter arrays a and
b (your method can assume that these arrays have same length) are the same overall shape in that
every position i has the same classification (upstep, downstep or plateau) in both arrays.(java
language)
Solution
public static void compareArrays(int[] array1, int[] array2) { boolean b = false; for (int i = 0; i <
array2.length; i++) { for (int a = 0; a < array1.length; a++) { if (array2[i] == array1[a]) { b =
true; System.out.println("true"); } else { b = false; System.out.println("False"); break; } } } }

Weitere ähnliche Inhalte

Mehr von jkristen1

B- lonic Bonds- Some atoms have such a strong attraction for electrons.docx
B- lonic Bonds- Some atoms have such a strong attraction for electrons.docxB- lonic Bonds- Some atoms have such a strong attraction for electrons.docx
B- lonic Bonds- Some atoms have such a strong attraction for electrons.docx
jkristen1
 
b- Does Rutherford-'s model predict the correct spectrum- Answer- Acco.docx
b- Does Rutherford-'s model predict the correct spectrum- Answer- Acco.docxb- Does Rutherford-'s model predict the correct spectrum- Answer- Acco.docx
b- Does Rutherford-'s model predict the correct spectrum- Answer- Acco.docx
jkristen1
 
Fill out the following table for four different IT systems- Note two.docx
Fill out the following table for four different IT systems-  Note two.docxFill out the following table for four different IT systems-  Note two.docx
Fill out the following table for four different IT systems- Note two.docx
jkristen1
 

Mehr von jkristen1 (20)

Based on differences in electronegativity- how would you characterize.docx
Based on differences in electronegativity- how would you characterize.docxBased on differences in electronegativity- how would you characterize.docx
Based on differences in electronegativity- how would you characterize.docx
 
Balance the redox reaction by inserting the appropriate coefficients-.docx
Balance the redox reaction by inserting the appropriate coefficients-.docxBalance the redox reaction by inserting the appropriate coefficients-.docx
Balance the redox reaction by inserting the appropriate coefficients-.docx
 
Auditing and Accounting Cases Investigating Issues of Fraud and Profes (2).docx
Auditing and Accounting Cases Investigating Issues of Fraud and Profes (2).docxAuditing and Accounting Cases Investigating Issues of Fraud and Profes (2).docx
Auditing and Accounting Cases Investigating Issues of Fraud and Profes (2).docx
 
b- Impact testing was used to assess which property of the materials-.docx
b- Impact testing was used to assess which property of the materials-.docxb- Impact testing was used to assess which property of the materials-.docx
b- Impact testing was used to assess which property of the materials-.docx
 
B- lonic Bonds- Some atoms have such a strong attraction for electrons.docx
B- lonic Bonds- Some atoms have such a strong attraction for electrons.docxB- lonic Bonds- Some atoms have such a strong attraction for electrons.docx
B- lonic Bonds- Some atoms have such a strong attraction for electrons.docx
 
b- Does Rutherford-'s model predict the correct spectrum- Answer- Acco.docx
b- Does Rutherford-'s model predict the correct spectrum- Answer- Acco.docxb- Does Rutherford-'s model predict the correct spectrum- Answer- Acco.docx
b- Does Rutherford-'s model predict the correct spectrum- Answer- Acco.docx
 
Auditors should perform audit procedures to identify and assess subseq.docx
Auditors should perform audit procedures to identify and assess subseq.docxAuditors should perform audit procedures to identify and assess subseq.docx
Auditors should perform audit procedures to identify and assess subseq.docx
 
Auditing and Accounting Cases Investigating Issues of Fraud and Profes.docx
Auditing and Accounting Cases Investigating Issues of Fraud and Profes.docxAuditing and Accounting Cases Investigating Issues of Fraud and Profes.docx
Auditing and Accounting Cases Investigating Issues of Fraud and Profes.docx
 
AuditorSolution1) The auditors opinion on internal control is satisfie.docx
AuditorSolution1) The auditors opinion on internal control is satisfie.docxAuditorSolution1) The auditors opinion on internal control is satisfie.docx
AuditorSolution1) The auditors opinion on internal control is satisfie.docx
 
Auditing and Accounting Cases Investigating Issues of Fraud and Profes (5).docx
Auditing and Accounting Cases Investigating Issues of Fraud and Profes (5).docxAuditing and Accounting Cases Investigating Issues of Fraud and Profes (5).docx
Auditing and Accounting Cases Investigating Issues of Fraud and Profes (5).docx
 
Athens- Inc-- has 9-000 shares of common stock outstanding and the fol.docx
Athens- Inc-- has 9-000 shares of common stock outstanding and the fol.docxAthens- Inc-- has 9-000 shares of common stock outstanding and the fol.docx
Athens- Inc-- has 9-000 shares of common stock outstanding and the fol.docx
 
At time 110 four processes (P1 P4) are waiting for a timeout signal-.docx
At time 110 four processes (P1  P4) are waiting for a timeout signal-.docxAt time 110 four processes (P1  P4) are waiting for a timeout signal-.docx
At time 110 four processes (P1 P4) are waiting for a timeout signal-.docx
 
At January 1- 2012- Lance Link Corporation had 100-000 shares of $1 pa.docx
At January 1- 2012- Lance Link Corporation had 100-000 shares of $1 pa.docxAt January 1- 2012- Lance Link Corporation had 100-000 shares of $1 pa.docx
At January 1- 2012- Lance Link Corporation had 100-000 shares of $1 pa.docx
 
At December 31- 2013- Hansen Corporation had 42-000 shares of common s.docx
At December 31- 2013- Hansen Corporation had 42-000 shares of common s.docxAt December 31- 2013- Hansen Corporation had 42-000 shares of common s.docx
At December 31- 2013- Hansen Corporation had 42-000 shares of common s.docx
 
File- LineScrabbleDriver-java -U 4- in-Desktop-Guess this is the death.docx
File- LineScrabbleDriver-java -U 4- in-Desktop-Guess this is the death.docxFile- LineScrabbleDriver-java -U 4- in-Desktop-Guess this is the death.docx
File- LineScrabbleDriver-java -U 4- in-Desktop-Guess this is the death.docx
 
Fill out the following table for four different IT systems- Note two.docx
Fill out the following table for four different IT systems-  Note two.docxFill out the following table for four different IT systems-  Note two.docx
Fill out the following table for four different IT systems- Note two.docx
 
Figure 9-3 shows an energy diagram for the dissolving of an ionic comp.docx
Figure 9-3 shows an energy diagram for the dissolving of an ionic comp.docxFigure 9-3 shows an energy diagram for the dissolving of an ionic comp.docx
Figure 9-3 shows an energy diagram for the dissolving of an ionic comp.docx
 
FakeArrayList first - new FakeArrayl_ist(3)- first-set(2- 7-1)- first-.docx
FakeArrayList first - new FakeArrayl_ist(3)- first-set(2- 7-1)- first-.docxFakeArrayList first - new FakeArrayl_ist(3)- first-set(2- 7-1)- first-.docx
FakeArrayList first - new FakeArrayl_ist(3)- first-set(2- 7-1)- first-.docx
 
Explain why workplace spirituality seems to be an important concern-So.docx
Explain why workplace spirituality seems to be an important concern-So.docxExplain why workplace spirituality seems to be an important concern-So.docx
Explain why workplace spirituality seems to be an important concern-So.docx
 
Explanation of the similarities and differences between the Income Sta.docx
Explanation of the similarities and differences between the Income Sta.docxExplanation of the similarities and differences between the Income Sta.docx
Explanation of the similarities and differences between the Income Sta.docx
 

Kürzlich hochgeladen

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 

Based on how the value in some array position i compares to the value.docx

  • 1. Based on how the value in some array position i compares to the value in its successor position i + 1, each position i in the array a is classified as an u pstep if a [i ] < a [i + 1], a d ownstep if a [i ] > a[ i + 1], and a plateau if a [ i ] == a [ i + 1]. The last position of the array has no such classification, since there is no successor element that we could compare it with. write a method with boolean sameStepShape(int[] a, int[] b) that checks whether the two parameter arrays a and b (your method can assume that these arrays have same length) are the same overall shape in that every position i has the same classification (upstep, downstep or plateau) in both arrays.(java language) Solution public static void compareArrays(int[] array1, int[] array2) { boolean b = false; for (int i = 0; i < array2.length; i++) { for (int a = 0; a < array1.length; a++) { if (array2[i] == array1[a]) { b = true; System.out.println("true"); } else { b = false; System.out.println("False"); break; } } } }