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

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
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Kürzlich hochgeladen (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
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
 
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
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
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
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
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
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
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
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
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...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
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
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
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
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
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
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

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