SlideShare a Scribd company logo
1 of 2
Please help!
Using Java
Write the program that will do the following tasks:
1)Declare a 5 X 8 integer array
2) Using nested for loops prompt and ask the user to enter all 40 values in the array.
3. Output the largest value in the array
4. Output the smallest number in the array
Solution
package Array;
import java.util.Scanner;
public class twodimensional_array {
public static void main (String[] args)Â Â {
Scanner scanner = new Scanner (System.in);
int rows;
int columns;
System.out.println("Enter number of rows: ");
rows = scanner.nextInt();
System.out.println ("Now enter the number of columns: ");
columns = scanner.nextInt();
int [][] matrix = new int [rows] [columns];
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
System.out.println("Enter the number for row " + i + " and column " + j + " : ");
matrix [i][j] = scanner.nextInt();
System.out.println("Matrix A: ");
for (int i1 = 0; i1 < matrix .length; i1++) {
System.out.println();
for (int j1 = 0; j1 < matrix [i].length; j1++) {
System.out.print(matrix [i1][j1] + " ");
}
}
}
}
System.out.println("Matrix A: ");
for (int i1 = 0; i1 < matrix .length; i1++) {
System.out.println();
for (int j1 = 0; j1 < matrix [i1].length; j1++) {
System.out.print(matrix [i1][j1] + " ");
}
}
int maxValue = Integer.MIN_VALUE;
System.out.println(" Max values in 2D array: ");
for (int i2 = 0; i2 < matrix.length; i2++)
for (int j2 = 0; j2 < matrix[i2].length; j2++)
if (matrix[i2][j2] > maxValue)
maxValue = matrix[i2][j2];
System.out.println("Maximum value: " + maxValue);
int minValue =Integer.MAX_VALUE;
System.out.println(" Min values in 2D array: ");
for (int i2 = 0; i2 < matrix.length; i2++)
for (int j2 = 0; j2 < matrix[i2].length; j2++)
if (matrix[i2][j2] < minValue)
minValue = matrix[i2][j2];
System.out.println("Minimum value: " + minValue);
}
}
Here i created a tw dimensional array where you can give your own dimensions and you can pass
the different elements you want.Hope this help you out

More Related Content

Similar to Please help! Using Java Write the program that will do the following t.docx

WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...MaruMengesha
 
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfMagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfanjanacottonmills
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Sunil Kumar Gunasekaran
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptxKimVeeL
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...MaruMengesha
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfrajeshjangid1865
 
DS LAB RECORD.docx
DS LAB RECORD.docxDS LAB RECORD.docx
DS LAB RECORD.docxdavinci54
 
Write the program in MIPS that declares an array of positive integer.pdf
Write the program in MIPS that declares an array of positive integer.pdfWrite the program in MIPS that declares an array of positive integer.pdf
Write the program in MIPS that declares an array of positive integer.pdfarihanthtoysandgifts
 
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdfrushabhshah600
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iiiNiraj Bharambe
 
JAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfJAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfRohitkumarYadav80
 

Similar to Please help! Using Java Write the program that will do the following t.docx (19)

WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
 
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfMagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
 
Ann
AnnAnn
Ann
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
 
Los dskn
Los dsknLos dskn
Los dskn
 
Oot practical
Oot practicalOot practical
Oot practical
 
Huraira_waris_Assgnment_4.docx
Huraira_waris_Assgnment_4.docxHuraira_waris_Assgnment_4.docx
Huraira_waris_Assgnment_4.docx
 
Java Unit 1 Project
Java Unit 1 ProjectJava Unit 1 Project
Java Unit 1 Project
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdf
 
6_Array.pptx
6_Array.pptx6_Array.pptx
6_Array.pptx
 
DS LAB RECORD.docx
DS LAB RECORD.docxDS LAB RECORD.docx
DS LAB RECORD.docx
 
Write the program in MIPS that declares an array of positive integer.pdf
Write the program in MIPS that declares an array of positive integer.pdfWrite the program in MIPS that declares an array of positive integer.pdf
Write the program in MIPS that declares an array of positive integer.pdf
 
WAP to add two given matrices in Java
WAP to add two given matrices in JavaWAP to add two given matrices in Java
WAP to add two given matrices in Java
 
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
Java programs
Java programsJava programs
Java programs
 
JAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfJAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdf
 

More from rtodd19

Please identify hardware device(s) (peripherals) and describe how a NO.docx
Please identify hardware device(s) (peripherals) and describe how a NO.docxPlease identify hardware device(s) (peripherals) and describe how a NO.docx
Please identify hardware device(s) (peripherals) and describe how a NO.docxrtodd19
 
please list two of the devices provided by the text (or other devices-.docx
please list two of the devices provided by the text (or other devices-.docxplease list two of the devices provided by the text (or other devices-.docx
please list two of the devices provided by the text (or other devices-.docxrtodd19
 
Please I need this answered with refrences - Thanks In a database- to.docx
Please I need this answered with refrences - Thanks In a database- to.docxPlease I need this answered with refrences - Thanks In a database- to.docx
Please I need this answered with refrences - Thanks In a database- to.docxrtodd19
 
Please help- thanks- Many government agencies and other organizations.docx
Please help- thanks- Many government agencies and other organizations.docxPlease help- thanks- Many government agencies and other organizations.docx
Please help- thanks- Many government agencies and other organizations.docxrtodd19
 
Please explain Advanced Persistent Threat!SolutionAnswer- An advanced.docx
Please explain Advanced Persistent Threat!SolutionAnswer- An advanced.docxPlease explain Advanced Persistent Threat!SolutionAnswer- An advanced.docx
Please explain Advanced Persistent Threat!SolutionAnswer- An advanced.docxrtodd19
 
Please explain--- a) why SO2 (g) and H2O (l) formed instead of H2 (g)-.docx
Please explain--- a) why SO2 (g) and H2O (l) formed instead of H2 (g)-.docxPlease explain--- a) why SO2 (g) and H2O (l) formed instead of H2 (g)-.docx
Please explain--- a) why SO2 (g) and H2O (l) formed instead of H2 (g)-.docxrtodd19
 
Please don-'t copy from an outside source Briefly discuss the distribu.docx
Please don-'t copy from an outside source Briefly discuss the distribu.docxPlease don-'t copy from an outside source Briefly discuss the distribu.docx
Please don-'t copy from an outside source Briefly discuss the distribu.docxrtodd19
 
Please distinguish between a malware and a virus- How are they same an.docx
Please distinguish between a malware and a virus- How are they same an.docxPlease distinguish between a malware and a virus- How are they same an.docx
Please distinguish between a malware and a virus- How are they same an.docxrtodd19
 
Please answer part c of the question- Thank you- The International Ato.docx
Please answer part c of the question- Thank you- The International Ato.docxPlease answer part c of the question- Thank you- The International Ato.docx
Please answer part c of the question- Thank you- The International Ato.docxrtodd19
 
Pictorialize a human being as a computer system-SolutionThe human nerv.docx
Pictorialize a human being as a computer system-SolutionThe human nerv.docxPictorialize a human being as a computer system-SolutionThe human nerv.docx
Pictorialize a human being as a computer system-SolutionThe human nerv.docxrtodd19
 
Personal Trainer- Inc- owns and operates fitness centers in a dozen Mi.docx
Personal Trainer- Inc- owns and operates fitness centers in a dozen Mi.docxPersonal Trainer- Inc- owns and operates fitness centers in a dozen Mi.docx
Personal Trainer- Inc- owns and operates fitness centers in a dozen Mi.docxrtodd19
 
Peruse the readings by Bennis and Nanus- Schein- and Ulrich and Lake-.docx
Peruse the readings by Bennis and Nanus- Schein- and Ulrich and Lake-.docxPeruse the readings by Bennis and Nanus- Schein- and Ulrich and Lake-.docx
Peruse the readings by Bennis and Nanus- Schein- and Ulrich and Lake-.docxrtodd19
 
Why do some authors view investment cash flow sensitivity as a symptom.docx
Why do some authors view investment cash flow sensitivity as a symptom.docxWhy do some authors view investment cash flow sensitivity as a symptom.docx
Why do some authors view investment cash flow sensitivity as a symptom.docxrtodd19
 
Why do some converging technologies raise special ethical and social i.docx
Why do some converging technologies raise special ethical and social i.docxWhy do some converging technologies raise special ethical and social i.docx
Why do some converging technologies raise special ethical and social i.docxrtodd19
 
Why do the outer stars in our galaxy not slow down- as Keplers laws of.docx
Why do the outer stars in our galaxy not slow down- as Keplers laws of.docxWhy do the outer stars in our galaxy not slow down- as Keplers laws of.docx
Why do the outer stars in our galaxy not slow down- as Keplers laws of.docxrtodd19
 
Why are concentrated interests and diffuse costs important in predicti.docx
Why are concentrated interests and diffuse costs important in predicti.docxWhy are concentrated interests and diffuse costs important in predicti.docx
Why are concentrated interests and diffuse costs important in predicti.docxrtodd19
 
Who are organizational stakeholders and what types of responsibilities.docx
Who are organizational stakeholders and what types of responsibilities.docxWho are organizational stakeholders and what types of responsibilities.docx
Who are organizational stakeholders and what types of responsibilities.docxrtodd19
 
Who are the principle stake holders of the company- Did Dole treat the.docx
Who are the principle stake holders of the company- Did Dole treat the.docxWho are the principle stake holders of the company- Did Dole treat the.docx
Who are the principle stake holders of the company- Did Dole treat the.docxrtodd19
 
Which type of network covers a contiguous geographic area- such as an.docx
Which type of network covers a contiguous geographic area- such as an.docxWhich type of network covers a contiguous geographic area- such as an.docx
Which type of network covers a contiguous geographic area- such as an.docxrtodd19
 
Which space is the most abundant in 1-0 M of wak acid HCN solution- As.docx
Which space is the most abundant in 1-0 M of wak acid HCN solution- As.docxWhich space is the most abundant in 1-0 M of wak acid HCN solution- As.docx
Which space is the most abundant in 1-0 M of wak acid HCN solution- As.docxrtodd19
 

More from rtodd19 (20)

Please identify hardware device(s) (peripherals) and describe how a NO.docx
Please identify hardware device(s) (peripherals) and describe how a NO.docxPlease identify hardware device(s) (peripherals) and describe how a NO.docx
Please identify hardware device(s) (peripherals) and describe how a NO.docx
 
please list two of the devices provided by the text (or other devices-.docx
please list two of the devices provided by the text (or other devices-.docxplease list two of the devices provided by the text (or other devices-.docx
please list two of the devices provided by the text (or other devices-.docx
 
Please I need this answered with refrences - Thanks In a database- to.docx
Please I need this answered with refrences - Thanks In a database- to.docxPlease I need this answered with refrences - Thanks In a database- to.docx
Please I need this answered with refrences - Thanks In a database- to.docx
 
Please help- thanks- Many government agencies and other organizations.docx
Please help- thanks- Many government agencies and other organizations.docxPlease help- thanks- Many government agencies and other organizations.docx
Please help- thanks- Many government agencies and other organizations.docx
 
Please explain Advanced Persistent Threat!SolutionAnswer- An advanced.docx
Please explain Advanced Persistent Threat!SolutionAnswer- An advanced.docxPlease explain Advanced Persistent Threat!SolutionAnswer- An advanced.docx
Please explain Advanced Persistent Threat!SolutionAnswer- An advanced.docx
 
Please explain--- a) why SO2 (g) and H2O (l) formed instead of H2 (g)-.docx
Please explain--- a) why SO2 (g) and H2O (l) formed instead of H2 (g)-.docxPlease explain--- a) why SO2 (g) and H2O (l) formed instead of H2 (g)-.docx
Please explain--- a) why SO2 (g) and H2O (l) formed instead of H2 (g)-.docx
 
Please don-'t copy from an outside source Briefly discuss the distribu.docx
Please don-'t copy from an outside source Briefly discuss the distribu.docxPlease don-'t copy from an outside source Briefly discuss the distribu.docx
Please don-'t copy from an outside source Briefly discuss the distribu.docx
 
Please distinguish between a malware and a virus- How are they same an.docx
Please distinguish between a malware and a virus- How are they same an.docxPlease distinguish between a malware and a virus- How are they same an.docx
Please distinguish between a malware and a virus- How are they same an.docx
 
Please answer part c of the question- Thank you- The International Ato.docx
Please answer part c of the question- Thank you- The International Ato.docxPlease answer part c of the question- Thank you- The International Ato.docx
Please answer part c of the question- Thank you- The International Ato.docx
 
Pictorialize a human being as a computer system-SolutionThe human nerv.docx
Pictorialize a human being as a computer system-SolutionThe human nerv.docxPictorialize a human being as a computer system-SolutionThe human nerv.docx
Pictorialize a human being as a computer system-SolutionThe human nerv.docx
 
Personal Trainer- Inc- owns and operates fitness centers in a dozen Mi.docx
Personal Trainer- Inc- owns and operates fitness centers in a dozen Mi.docxPersonal Trainer- Inc- owns and operates fitness centers in a dozen Mi.docx
Personal Trainer- Inc- owns and operates fitness centers in a dozen Mi.docx
 
Peruse the readings by Bennis and Nanus- Schein- and Ulrich and Lake-.docx
Peruse the readings by Bennis and Nanus- Schein- and Ulrich and Lake-.docxPeruse the readings by Bennis and Nanus- Schein- and Ulrich and Lake-.docx
Peruse the readings by Bennis and Nanus- Schein- and Ulrich and Lake-.docx
 
Why do some authors view investment cash flow sensitivity as a symptom.docx
Why do some authors view investment cash flow sensitivity as a symptom.docxWhy do some authors view investment cash flow sensitivity as a symptom.docx
Why do some authors view investment cash flow sensitivity as a symptom.docx
 
Why do some converging technologies raise special ethical and social i.docx
Why do some converging technologies raise special ethical and social i.docxWhy do some converging technologies raise special ethical and social i.docx
Why do some converging technologies raise special ethical and social i.docx
 
Why do the outer stars in our galaxy not slow down- as Keplers laws of.docx
Why do the outer stars in our galaxy not slow down- as Keplers laws of.docxWhy do the outer stars in our galaxy not slow down- as Keplers laws of.docx
Why do the outer stars in our galaxy not slow down- as Keplers laws of.docx
 
Why are concentrated interests and diffuse costs important in predicti.docx
Why are concentrated interests and diffuse costs important in predicti.docxWhy are concentrated interests and diffuse costs important in predicti.docx
Why are concentrated interests and diffuse costs important in predicti.docx
 
Who are organizational stakeholders and what types of responsibilities.docx
Who are organizational stakeholders and what types of responsibilities.docxWho are organizational stakeholders and what types of responsibilities.docx
Who are organizational stakeholders and what types of responsibilities.docx
 
Who are the principle stake holders of the company- Did Dole treat the.docx
Who are the principle stake holders of the company- Did Dole treat the.docxWho are the principle stake holders of the company- Did Dole treat the.docx
Who are the principle stake holders of the company- Did Dole treat the.docx
 
Which type of network covers a contiguous geographic area- such as an.docx
Which type of network covers a contiguous geographic area- such as an.docxWhich type of network covers a contiguous geographic area- such as an.docx
Which type of network covers a contiguous geographic area- such as an.docx
 
Which space is the most abundant in 1-0 M of wak acid HCN solution- As.docx
Which space is the most abundant in 1-0 M of wak acid HCN solution- As.docxWhich space is the most abundant in 1-0 M of wak acid HCN solution- As.docx
Which space is the most abundant in 1-0 M of wak acid HCN solution- As.docx
 

Recently uploaded

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
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
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
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
 
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
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
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
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
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
 

Recently uploaded (20)

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
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
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
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
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
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
 
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
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.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)
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
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
 

Please help! Using Java Write the program that will do the following t.docx

  • 1. Please help! Using Java Write the program that will do the following tasks: 1)Declare a 5 X 8 integer array 2) Using nested for loops prompt and ask the user to enter all 40 values in the array. 3. Output the largest value in the array 4. Output the smallest number in the array Solution package Array; import java.util.Scanner; public class twodimensional_array { public static void main (String[] args)Â Â { Scanner scanner = new Scanner (System.in); int rows; int columns; System.out.println("Enter number of rows: "); rows = scanner.nextInt(); System.out.println ("Now enter the number of columns: "); columns = scanner.nextInt(); int [][] matrix = new int [rows] [columns]; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { System.out.println("Enter the number for row " + i + " and column " + j + " : "); matrix [i][j] = scanner.nextInt(); System.out.println("Matrix A: "); for (int i1 = 0; i1 < matrix .length; i1++) { System.out.println(); for (int j1 = 0; j1 < matrix [i].length; j1++) { System.out.print(matrix [i1][j1] + " "); } }
  • 2. } } System.out.println("Matrix A: "); for (int i1 = 0; i1 < matrix .length; i1++) { System.out.println(); for (int j1 = 0; j1 < matrix [i1].length; j1++) { System.out.print(matrix [i1][j1] + " "); } } int maxValue = Integer.MIN_VALUE; System.out.println(" Max values in 2D array: "); for (int i2 = 0; i2 < matrix.length; i2++) for (int j2 = 0; j2 < matrix[i2].length; j2++) if (matrix[i2][j2] > maxValue) maxValue = matrix[i2][j2]; System.out.println("Maximum value: " + maxValue); int minValue =Integer.MAX_VALUE; System.out.println(" Min values in 2D array: "); for (int i2 = 0; i2 < matrix.length; i2++) for (int j2 = 0; j2 < matrix[i2].length; j2++) if (matrix[i2][j2] < minValue) minValue = matrix[i2][j2]; System.out.println("Minimum value: " + minValue); } } Here i created a tw dimensional array where you can give your own dimensions and you can pass the different elements you want.Hope this help you out