SlideShare a Scribd company logo
1 of 3
Exercise #1:
Write a program that declares a two-dimensional array named myFancyArray of the type double.
Initialize the array to the following values:
23 14.12 17 85.99
6.06 13 1100 0
36.36 90.09 3.145 5.4
1. Create a function that will return the sum of column three. Output this result.
2. Create a function that finds the ceiling of each value in the array.
3. Create a function that will use a nested loop to display all the elements in the array to the
screen.
Solution
in java
package s1;
class extra {
public static double sum(double a, double b, double c) {
return a + b + c;
}
public static void ceiling(double a[][]) {
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[a.length - 1].length; j++) {
System.out.print(Math.ceil(a[i][j]) + "t");
}
System.out.println("");
}
}
public static void print(double a[][]) {
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[a.length - 1].length; j++) {
System.out.print(a[i][j] + "t");
}
System.out.println("");
}
}
public static void main(String[] args) {
double[][] myFancyArray = {{23, 14.12, 17, 85.99}, {6.06, 13, 1100, 0}, {36.36, 90.09, 3.145,
5.4}};
System.out.println("Sum="+sum( myFancyArray[0][0],myFancyArray[1][1],
myFancyArray[2][2]));
System.out.println("ceiling");
ceiling(myFancyArray);
System.out.println("print");
print(myFancyArray);
}
}
output
run:
Sum=39.145
ceiling
23.0Â Â 15.0Â Â 17.0Â Â 86.0
7.0Â Â 13.0Â Â 1100.0Â Â 0.0
37.0Â Â 91.0Â Â 4.0Â Â 6.0
print
23.0Â Â 14.12Â Â 17.0Â Â 85.99
6.06Â Â 13.0Â Â 1100.0Â Â 0.0
36.36Â Â 90.09Â Â 3.145Â Â 5.4
BUILD SUCCESSFUL (total time: 0 seconds)
Exercise #1- Write a program that declares a two-dimensional array nam.docx

More Related Content

Similar to Exercise #1- Write a program that declares a two-dimensional array nam.docx

Python 03-parameters-graphics.pptx
Python 03-parameters-graphics.pptxPython 03-parameters-graphics.pptx
Python 03-parameters-graphics.pptxTseChris
 
Cs2312 OOPS LAB MANUAL
Cs2312 OOPS LAB MANUALCs2312 OOPS LAB MANUAL
Cs2312 OOPS LAB MANUALPrabhu D
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iiiNiraj Bharambe
 
Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
 Problem1 java codeimport java.util.Scanner; Java code to pr.pdf Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
Problem1 java codeimport java.util.Scanner; Java code to pr.pdfanupamfootwear
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 
Java Programs
Java ProgramsJava Programs
Java Programsvvpadhu
 
two dimensional array
two dimensional array two dimensional array
two dimensional array Tariq Aziz
 
Java Questions
Java QuestionsJava Questions
Java Questionsbindur87
 
Java programming lab manual
Java programming lab manualJava programming lab manual
Java programming lab manualsameer farooq
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2Kaela Johnson
 

Similar to Exercise #1- Write a program that declares a two-dimensional array nam.docx (20)

Python 03-parameters-graphics.pptx
Python 03-parameters-graphics.pptxPython 03-parameters-graphics.pptx
Python 03-parameters-graphics.pptx
 
CP Handout#9
CP Handout#9CP Handout#9
CP Handout#9
 
JAVAPGMS.docx
JAVAPGMS.docxJAVAPGMS.docx
JAVAPGMS.docx
 
Cs2312 OOPS LAB MANUAL
Cs2312 OOPS LAB MANUALCs2312 OOPS LAB MANUAL
Cs2312 OOPS LAB MANUAL
 
Java practical
Java practicalJava practical
Java practical
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
 Problem1 java codeimport java.util.Scanner; Java code to pr.pdf Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
Problem1 java codeimport java.util.Scanner; Java code to pr.pdf
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
Lecture 1 mte 407
Lecture 1 mte 407Lecture 1 mte 407
Lecture 1 mte 407
 
Lecture 1 mte 407
Lecture 1 mte 407Lecture 1 mte 407
Lecture 1 mte 407
 
two dimensional array
two dimensional array two dimensional array
two dimensional array
 
White box-sol
White box-solWhite box-sol
White box-sol
 
Java Lab Manual
Java Lab ManualJava Lab Manual
Java Lab Manual
 
Container adapters
Container adaptersContainer adapters
Container adapters
 
Java Questions
Java QuestionsJava Questions
Java Questions
 
JavaProgrammingManual
JavaProgrammingManualJavaProgrammingManual
JavaProgrammingManual
 
Java programming lab manual
Java programming lab manualJava programming lab manual
Java programming lab manual
 
Assignment Java Programming 2
Assignment Java Programming 2Assignment Java Programming 2
Assignment Java Programming 2
 

More from vtuan3

Arrange the following elements from greatest to least tendency to acce.docx
Arrange the following elements from greatest to least tendency to acce.docxArrange the following elements from greatest to least tendency to acce.docx
Arrange the following elements from greatest to least tendency to acce.docxvtuan3
 
Arrange the elution sequence of the following compounds by using rever.docx
Arrange the elution sequence of the following compounds by using rever.docxArrange the elution sequence of the following compounds by using rever.docx
Arrange the elution sequence of the following compounds by using rever.docxvtuan3
 
Are you surprised by the variety and range of issues addressed by the.docx
Are you surprised by the variety and range of issues addressed by the.docxAre you surprised by the variety and range of issues addressed by the.docx
Are you surprised by the variety and range of issues addressed by the.docxvtuan3
 
Are there ethical considerations we should consider during the the ent.docx
Are there ethical considerations we should consider during the the ent.docxAre there ethical considerations we should consider during the the ent.docx
Are there ethical considerations we should consider during the the ent.docxvtuan3
 
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docxAP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docxvtuan3
 
answers- 22- H lysine- You do not have to write them all out- ow many.docx
answers- 22- H lysine- You do not have to write them all out- ow many.docxanswers- 22- H lysine- You do not have to write them all out- ow many.docx
answers- 22- H lysine- You do not have to write them all out- ow many.docxvtuan3
 
Answer was D) but I need detailed help with steps as to how - On Janua.docx
Answer was D) but I need detailed help with steps as to how - On Janua.docxAnswer was D) but I need detailed help with steps as to how - On Janua.docx
Answer was D) but I need detailed help with steps as to how - On Janua.docxvtuan3
 
Answer the below in your own words- What were the reasons for the deco.docx
Answer the below in your own words- What were the reasons for the deco.docxAnswer the below in your own words- What were the reasons for the deco.docx
Answer the below in your own words- What were the reasons for the deco.docxvtuan3
 
Answer in your own words- Would you agree with Karl Marx in saying tha.docx
Answer in your own words- Would you agree with Karl Marx in saying tha.docxAnswer in your own words- Would you agree with Karl Marx in saying tha.docx
Answer in your own words- Would you agree with Karl Marx in saying tha.docxvtuan3
 
Analyze the role of credit rationing in both a developed country and a.docx
Analyze the role of credit rationing in both a developed country and a.docxAnalyze the role of credit rationing in both a developed country and a.docx
Analyze the role of credit rationing in both a developed country and a.docxvtuan3
 
Annual worth calculations require equal life alternatives- T or F - An.docx
Annual worth calculations require equal life alternatives- T or F - An.docxAnnual worth calculations require equal life alternatives- T or F - An.docx
Annual worth calculations require equal life alternatives- T or F - An.docxvtuan3
 
Annual editions of journal What will social media look like in the fu.docx
Annual editions of journal  What will social media look like in the fu.docxAnnual editions of journal  What will social media look like in the fu.docx
Annual editions of journal What will social media look like in the fu.docxvtuan3
 
An unknown mixture of ions was treated with hydrochloric acid resultin.docx
An unknown mixture of ions was treated with hydrochloric acid resultin.docxAn unknown mixture of ions was treated with hydrochloric acid resultin.docx
An unknown mixture of ions was treated with hydrochloric acid resultin.docxvtuan3
 
Analyze the role cryptographic algorithms play and explain how these a.docx
Analyze the role cryptographic algorithms play and explain how these a.docxAnalyze the role cryptographic algorithms play and explain how these a.docx
Analyze the role cryptographic algorithms play and explain how these a.docxvtuan3
 
Analyze and determine which sector- public or private- has greater ins.docx
Analyze and determine which sector- public or private- has greater ins.docxAnalyze and determine which sector- public or private- has greater ins.docx
Analyze and determine which sector- public or private- has greater ins.docxvtuan3
 
an102 Tollowing infrared spectra- Some examples of functional groups a.docx
an102 Tollowing infrared spectra- Some examples of functional groups a.docxan102 Tollowing infrared spectra- Some examples of functional groups a.docx
an102 Tollowing infrared spectra- Some examples of functional groups a.docxvtuan3
 
An unknown compound is one of the four compounds shown below- It is an.docx
An unknown compound is one of the four compounds shown below- It is an.docxAn unknown compound is one of the four compounds shown below- It is an.docx
An unknown compound is one of the four compounds shown below- It is an.docxvtuan3
 
Analyze the types of informal and formal communication in organization.docx
Analyze the types of informal and formal communication in organization.docxAnalyze the types of informal and formal communication in organization.docx
Analyze the types of informal and formal communication in organization.docxvtuan3
 
Encapsulation process- Explain this process giving specific detail at.docx
Encapsulation process- Explain this process giving specific detail at.docxEncapsulation process- Explain this process giving specific detail at.docx
Encapsulation process- Explain this process giving specific detail at.docxvtuan3
 
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docxElijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docxvtuan3
 

More from vtuan3 (20)

Arrange the following elements from greatest to least tendency to acce.docx
Arrange the following elements from greatest to least tendency to acce.docxArrange the following elements from greatest to least tendency to acce.docx
Arrange the following elements from greatest to least tendency to acce.docx
 
Arrange the elution sequence of the following compounds by using rever.docx
Arrange the elution sequence of the following compounds by using rever.docxArrange the elution sequence of the following compounds by using rever.docx
Arrange the elution sequence of the following compounds by using rever.docx
 
Are you surprised by the variety and range of issues addressed by the.docx
Are you surprised by the variety and range of issues addressed by the.docxAre you surprised by the variety and range of issues addressed by the.docx
Are you surprised by the variety and range of issues addressed by the.docx
 
Are there ethical considerations we should consider during the the ent.docx
Are there ethical considerations we should consider during the the ent.docxAre there ethical considerations we should consider during the the ent.docx
Are there ethical considerations we should consider during the the ent.docx
 
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docxAP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
 
answers- 22- H lysine- You do not have to write them all out- ow many.docx
answers- 22- H lysine- You do not have to write them all out- ow many.docxanswers- 22- H lysine- You do not have to write them all out- ow many.docx
answers- 22- H lysine- You do not have to write them all out- ow many.docx
 
Answer was D) but I need detailed help with steps as to how - On Janua.docx
Answer was D) but I need detailed help with steps as to how - On Janua.docxAnswer was D) but I need detailed help with steps as to how - On Janua.docx
Answer was D) but I need detailed help with steps as to how - On Janua.docx
 
Answer the below in your own words- What were the reasons for the deco.docx
Answer the below in your own words- What were the reasons for the deco.docxAnswer the below in your own words- What were the reasons for the deco.docx
Answer the below in your own words- What were the reasons for the deco.docx
 
Answer in your own words- Would you agree with Karl Marx in saying tha.docx
Answer in your own words- Would you agree with Karl Marx in saying tha.docxAnswer in your own words- Would you agree with Karl Marx in saying tha.docx
Answer in your own words- Would you agree with Karl Marx in saying tha.docx
 
Analyze the role of credit rationing in both a developed country and a.docx
Analyze the role of credit rationing in both a developed country and a.docxAnalyze the role of credit rationing in both a developed country and a.docx
Analyze the role of credit rationing in both a developed country and a.docx
 
Annual worth calculations require equal life alternatives- T or F - An.docx
Annual worth calculations require equal life alternatives- T or F - An.docxAnnual worth calculations require equal life alternatives- T or F - An.docx
Annual worth calculations require equal life alternatives- T or F - An.docx
 
Annual editions of journal What will social media look like in the fu.docx
Annual editions of journal  What will social media look like in the fu.docxAnnual editions of journal  What will social media look like in the fu.docx
Annual editions of journal What will social media look like in the fu.docx
 
An unknown mixture of ions was treated with hydrochloric acid resultin.docx
An unknown mixture of ions was treated with hydrochloric acid resultin.docxAn unknown mixture of ions was treated with hydrochloric acid resultin.docx
An unknown mixture of ions was treated with hydrochloric acid resultin.docx
 
Analyze the role cryptographic algorithms play and explain how these a.docx
Analyze the role cryptographic algorithms play and explain how these a.docxAnalyze the role cryptographic algorithms play and explain how these a.docx
Analyze the role cryptographic algorithms play and explain how these a.docx
 
Analyze and determine which sector- public or private- has greater ins.docx
Analyze and determine which sector- public or private- has greater ins.docxAnalyze and determine which sector- public or private- has greater ins.docx
Analyze and determine which sector- public or private- has greater ins.docx
 
an102 Tollowing infrared spectra- Some examples of functional groups a.docx
an102 Tollowing infrared spectra- Some examples of functional groups a.docxan102 Tollowing infrared spectra- Some examples of functional groups a.docx
an102 Tollowing infrared spectra- Some examples of functional groups a.docx
 
An unknown compound is one of the four compounds shown below- It is an.docx
An unknown compound is one of the four compounds shown below- It is an.docxAn unknown compound is one of the four compounds shown below- It is an.docx
An unknown compound is one of the four compounds shown below- It is an.docx
 
Analyze the types of informal and formal communication in organization.docx
Analyze the types of informal and formal communication in organization.docxAnalyze the types of informal and formal communication in organization.docx
Analyze the types of informal and formal communication in organization.docx
 
Encapsulation process- Explain this process giving specific detail at.docx
Encapsulation process- Explain this process giving specific detail at.docxEncapsulation process- Explain this process giving specific detail at.docx
Encapsulation process- Explain this process giving specific detail at.docx
 
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docxElijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
 

Recently uploaded

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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
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
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 

Recently uploaded (20)

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
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
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
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

Exercise #1- Write a program that declares a two-dimensional array nam.docx

  • 1. Exercise #1: Write a program that declares a two-dimensional array named myFancyArray of the type double. Initialize the array to the following values: 23 14.12 17 85.99 6.06 13 1100 0 36.36 90.09 3.145 5.4 1. Create a function that will return the sum of column three. Output this result. 2. Create a function that finds the ceiling of each value in the array. 3. Create a function that will use a nested loop to display all the elements in the array to the screen. Solution in java package s1; class extra { public static double sum(double a, double b, double c) { return a + b + c; } public static void ceiling(double a[][]) { for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[a.length - 1].length; j++) { System.out.print(Math.ceil(a[i][j]) + "t"); } System.out.println(""); } }
  • 2. public static void print(double a[][]) { for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[a.length - 1].length; j++) { System.out.print(a[i][j] + "t"); } System.out.println(""); } } public static void main(String[] args) { double[][] myFancyArray = {{23, 14.12, 17, 85.99}, {6.06, 13, 1100, 0}, {36.36, 90.09, 3.145, 5.4}}; System.out.println("Sum="+sum( myFancyArray[0][0],myFancyArray[1][1], myFancyArray[2][2])); System.out.println("ceiling"); ceiling(myFancyArray); System.out.println("print"); print(myFancyArray); } } output run: Sum=39.145 ceiling 23.0Â Â 15.0Â Â 17.0Â Â 86.0 7.0Â Â 13.0Â Â 1100.0Â Â 0.0 37.0Â Â 91.0Â Â 4.0Â Â 6.0 print 23.0Â Â 14.12Â Â 17.0Â Â 85.99 6.06Â Â 13.0Â Â 1100.0Â Â 0.0 36.36Â Â 90.09Â Â 3.145Â Â 5.4 BUILD SUCCESSFUL (total time: 0 seconds)