SlideShare uma empresa Scribd logo
1 de 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; } } } }

Mais conteúdo relacionado

Mais de jkristen1

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.docxjkristen1
 
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-.docxjkristen1
 
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).docxjkristen1
 
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-.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 
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).docxjkristen1
 
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.docxjkristen1
 
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-.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 
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-.docxjkristen1
 
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.docxjkristen1
 
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.docxjkristen1
 

Mais de 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
 

Último

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 

Último (20)

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
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
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

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; } } } }