SlideShare a Scribd company logo
RainfallTest.java
import java.util.Arrays;
import java.util.Scanner;
public class RainfallTest {
/**
* @param args
*/
static String month[] = {"January", "Fabruary", "March", "April", "May", "June",
"July", "August", "September","October","November","December"};
public static void main(String[] args) {
// TODO Auto-generated method stub
int months[] = new int[12];
Scanner scan = new Scanner(System.in);
for(int i=0; i months[i]){
min = months[i];
minIndex = i;
}
}
System.out.println("The minimum rainfall is :"+min);
System.out.println("The minimum rainfall month is :"+month[minIndex]);
}
public static void updaeRainFallForMonth(int months[]){
Scanner scan = new Scanner(System.in);
System.out.println("Enter a month (1-12) for rainfall update:");
int month = scan.nextInt();
System.out.println("Enter rainfall for update:");
int rainfall = scan.nextInt();
months[month-1] = rainfall;
}
public static void exit(){
System.exit(0);
}
}
Output:
Enter Rainfall for the month 1:
55
Enter Rainfall for the month 2:
66
Enter Rainfall for the month 3:
77
Enter Rainfall for the month 4:
44
Enter Rainfall for the month 5:
33
Enter Rainfall for the month 6:
22
Enter Rainfall for the month 7:
11
Enter Rainfall for the month 8:
99
Enter Rainfall for the month 9:
88
Enter Rainfall for the month 10:
45
Enter Rainfall for the month 11:
56
Enter Rainfall for the month 12:
67
Entered rainfall details [55, 66, 77, 44, 33, 22, 11, 99, 88, 45, 56, 67]
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
1
January: 55
Fabruary: 66
March: 77
April: 44
May: 33
June: 22
July: 11
August: 99
September: 88
October: 45
November: 56
December: 67
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
2
The total rainfall is :663
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
3
The average rainfall is :55.25
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
4
The maximum rainfall is :99
The maximum rainfall month is :August
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
5
The minimum rainfall is :11
The minimum rainfall month is :July
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
6
Enter a month (1-12) for rainfall update:
7
Enter rainfall for update:
99
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
4
The maximum rainfall is :99
The maximum rainfall month is :July
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
7
Solution
RainfallTest.java
import java.util.Arrays;
import java.util.Scanner;
public class RainfallTest {
/**
* @param args
*/
static String month[] = {"January", "Fabruary", "March", "April", "May", "June",
"July", "August", "September","October","November","December"};
public static void main(String[] args) {
// TODO Auto-generated method stub
int months[] = new int[12];
Scanner scan = new Scanner(System.in);
for(int i=0; i months[i]){
min = months[i];
minIndex = i;
}
}
System.out.println("The minimum rainfall is :"+min);
System.out.println("The minimum rainfall month is :"+month[minIndex]);
}
public static void updaeRainFallForMonth(int months[]){
Scanner scan = new Scanner(System.in);
System.out.println("Enter a month (1-12) for rainfall update:");
int month = scan.nextInt();
System.out.println("Enter rainfall for update:");
int rainfall = scan.nextInt();
months[month-1] = rainfall;
}
public static void exit(){
System.exit(0);
}
}
Output:
Enter Rainfall for the month 1:
55
Enter Rainfall for the month 2:
66
Enter Rainfall for the month 3:
77
Enter Rainfall for the month 4:
44
Enter Rainfall for the month 5:
33
Enter Rainfall for the month 6:
22
Enter Rainfall for the month 7:
11
Enter Rainfall for the month 8:
99
Enter Rainfall for the month 9:
88
Enter Rainfall for the month 10:
45
Enter Rainfall for the month 11:
56
Enter Rainfall for the month 12:
67
Entered rainfall details [55, 66, 77, 44, 33, 22, 11, 99, 88, 45, 56, 67]
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
1
January: 55
Fabruary: 66
March: 77
April: 44
May: 33
June: 22
July: 11
August: 99
September: 88
October: 45
November: 56
December: 67
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
2
The total rainfall is :663
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
3
The average rainfall is :55.25
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
4
The maximum rainfall is :99
The maximum rainfall month is :August
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
5
The minimum rainfall is :11
The minimum rainfall month is :July
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
6
Enter a month (1-12) for rainfall update:
7
Enter rainfall for update:
99
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
4
The maximum rainfall is :99
The maximum rainfall month is :July
Enter your choice:
1.the rainfall for each month
2.the total rainfall for the year
3.find the average monthly rainfall
4.the name of the month with the most rain
.5.the name of the month with the least rain.
6.update the amount of rain in any given month
7.quit
7

More Related Content

More from anithareadymade

The possible causative agent is Corynebacterium diptheriaeSore thr.pdf
The possible causative agent is Corynebacterium diptheriaeSore thr.pdfThe possible causative agent is Corynebacterium diptheriaeSore thr.pdf
The possible causative agent is Corynebacterium diptheriaeSore thr.pdf
anithareadymade
 
The answer is E) 1,2, and 3.The solubility of a gas in solvents de.pdf
The answer is E) 1,2, and 3.The solubility of a gas in solvents de.pdfThe answer is E) 1,2, and 3.The solubility of a gas in solvents de.pdf
The answer is E) 1,2, and 3.The solubility of a gas in solvents de.pdf
anithareadymade
 
by taking p1,p2,p3 as points in cordinate system.. displavement can .pdf
by taking p1,p2,p3 as points in cordinate system.. displavement can .pdfby taking p1,p2,p3 as points in cordinate system.. displavement can .pdf
by taking p1,p2,p3 as points in cordinate system.. displavement can .pdf
anithareadymade
 
import java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfimport java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdf
anithareadymade
 
i did not get itSolutioni did not get it.pdf
i did not get itSolutioni did not get it.pdfi did not get itSolutioni did not get it.pdf
i did not get itSolutioni did not get it.pdf
anithareadymade
 
Hello!!!!!!! This answer will help you ) H2Se would occur in a .pdf
Hello!!!!!!! This answer will help you ) H2Se would occur in a .pdfHello!!!!!!! This answer will help you ) H2Se would occur in a .pdf
Hello!!!!!!! This answer will help you ) H2Se would occur in a .pdf
anithareadymade
 
Here is the code for youimport java.util.Scanner; import java.u.pdf
Here is the code for youimport java.util.Scanner; import java.u.pdfHere is the code for youimport java.util.Scanner; import java.u.pdf
Here is the code for youimport java.util.Scanner; import java.u.pdf
anithareadymade
 
Following are the changes mentioned in bold in order to obtain the r.pdf
Following are the changes mentioned in bold in order to obtain the r.pdfFollowing are the changes mentioned in bold in order to obtain the r.pdf
Following are the changes mentioned in bold in order to obtain the r.pdf
anithareadymade
 
During meiosis, each member of a pair of genes tends to be randomly .pdf
During meiosis, each member of a pair of genes tends to be randomly .pdfDuring meiosis, each member of a pair of genes tends to be randomly .pdf
During meiosis, each member of a pair of genes tends to be randomly .pdf
anithareadymade
 
B parents marital statusSolutionB parents marital status.pdf
B parents marital statusSolutionB parents marital status.pdfB parents marital statusSolutionB parents marital status.pdf
B parents marital statusSolutionB parents marital status.pdf
anithareadymade
 
ANSWERS12. B collecting ducts13. B efferent arteriol15. juxtag.pdf
ANSWERS12. B collecting ducts13. B efferent arteriol15. juxtag.pdfANSWERS12. B collecting ducts13. B efferent arteriol15. juxtag.pdf
ANSWERS12. B collecting ducts13. B efferent arteriol15. juxtag.pdf
anithareadymade
 
Array- Arrays is a collection of data items with same data type and.pdf
Array- Arrays is a collection of data items with same data type and.pdfArray- Arrays is a collection of data items with same data type and.pdf
Array- Arrays is a collection of data items with same data type and.pdf
anithareadymade
 
Ans. A. During protein folding, the hydrophobic residues are buried .pdf
Ans. A. During protein folding, the hydrophobic residues are buried .pdfAns. A. During protein folding, the hydrophobic residues are buried .pdf
Ans. A. During protein folding, the hydrophobic residues are buried .pdf
anithareadymade
 
A)worst case complexityit will compare with all element .pdf
A)worst case complexityit will compare with all element .pdfA)worst case complexityit will compare with all element .pdf
A)worst case complexityit will compare with all element .pdf
anithareadymade
 
a) Our lungs are lined with the surfactant which has phospholipid an.pdf
a) Our lungs are lined with the surfactant which has phospholipid an.pdfa) Our lungs are lined with the surfactant which has phospholipid an.pdf
a) Our lungs are lined with the surfactant which has phospholipid an.pdf
anithareadymade
 
A four dimensional subspace cant be spanned by two vectors only. T.pdf
A four dimensional subspace cant be spanned by two vectors only. T.pdfA four dimensional subspace cant be spanned by two vectors only. T.pdf
A four dimensional subspace cant be spanned by two vectors only. T.pdf
anithareadymade
 
12L has mass 16 grams 22.4L of gas has M mass M= .pdf
                     12L has mass 16 grams 22.4L of gas has M mass M= .pdf                     12L has mass 16 grams 22.4L of gas has M mass M= .pdf
12L has mass 16 grams 22.4L of gas has M mass M= .pdf
anithareadymade
 
2 m5275145Solution2 m5275145.pdf
2 m5275145Solution2 m5275145.pdf2 m5275145Solution2 m5275145.pdf
2 m5275145Solution2 m5275145.pdf
anithareadymade
 
1.Personal Trainers Inc. is about to expand its’ successful fitnes.pdf
1.Personal Trainers Inc. is about to expand its’ successful fitnes.pdf1.Personal Trainers Inc. is about to expand its’ successful fitnes.pdf
1.Personal Trainers Inc. is about to expand its’ successful fitnes.pdf
anithareadymade
 
1) The Security wireless system is a Security technique which is use.pdf
1) The Security wireless system is a Security technique which is use.pdf1) The Security wireless system is a Security technique which is use.pdf
1) The Security wireless system is a Security technique which is use.pdf
anithareadymade
 

More from anithareadymade (20)

The possible causative agent is Corynebacterium diptheriaeSore thr.pdf
The possible causative agent is Corynebacterium diptheriaeSore thr.pdfThe possible causative agent is Corynebacterium diptheriaeSore thr.pdf
The possible causative agent is Corynebacterium diptheriaeSore thr.pdf
 
The answer is E) 1,2, and 3.The solubility of a gas in solvents de.pdf
The answer is E) 1,2, and 3.The solubility of a gas in solvents de.pdfThe answer is E) 1,2, and 3.The solubility of a gas in solvents de.pdf
The answer is E) 1,2, and 3.The solubility of a gas in solvents de.pdf
 
by taking p1,p2,p3 as points in cordinate system.. displavement can .pdf
by taking p1,p2,p3 as points in cordinate system.. displavement can .pdfby taking p1,p2,p3 as points in cordinate system.. displavement can .pdf
by taking p1,p2,p3 as points in cordinate system.. displavement can .pdf
 
import java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfimport java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdf
 
i did not get itSolutioni did not get it.pdf
i did not get itSolutioni did not get it.pdfi did not get itSolutioni did not get it.pdf
i did not get itSolutioni did not get it.pdf
 
Hello!!!!!!! This answer will help you ) H2Se would occur in a .pdf
Hello!!!!!!! This answer will help you ) H2Se would occur in a .pdfHello!!!!!!! This answer will help you ) H2Se would occur in a .pdf
Hello!!!!!!! This answer will help you ) H2Se would occur in a .pdf
 
Here is the code for youimport java.util.Scanner; import java.u.pdf
Here is the code for youimport java.util.Scanner; import java.u.pdfHere is the code for youimport java.util.Scanner; import java.u.pdf
Here is the code for youimport java.util.Scanner; import java.u.pdf
 
Following are the changes mentioned in bold in order to obtain the r.pdf
Following are the changes mentioned in bold in order to obtain the r.pdfFollowing are the changes mentioned in bold in order to obtain the r.pdf
Following are the changes mentioned in bold in order to obtain the r.pdf
 
During meiosis, each member of a pair of genes tends to be randomly .pdf
During meiosis, each member of a pair of genes tends to be randomly .pdfDuring meiosis, each member of a pair of genes tends to be randomly .pdf
During meiosis, each member of a pair of genes tends to be randomly .pdf
 
B parents marital statusSolutionB parents marital status.pdf
B parents marital statusSolutionB parents marital status.pdfB parents marital statusSolutionB parents marital status.pdf
B parents marital statusSolutionB parents marital status.pdf
 
ANSWERS12. B collecting ducts13. B efferent arteriol15. juxtag.pdf
ANSWERS12. B collecting ducts13. B efferent arteriol15. juxtag.pdfANSWERS12. B collecting ducts13. B efferent arteriol15. juxtag.pdf
ANSWERS12. B collecting ducts13. B efferent arteriol15. juxtag.pdf
 
Array- Arrays is a collection of data items with same data type and.pdf
Array- Arrays is a collection of data items with same data type and.pdfArray- Arrays is a collection of data items with same data type and.pdf
Array- Arrays is a collection of data items with same data type and.pdf
 
Ans. A. During protein folding, the hydrophobic residues are buried .pdf
Ans. A. During protein folding, the hydrophobic residues are buried .pdfAns. A. During protein folding, the hydrophobic residues are buried .pdf
Ans. A. During protein folding, the hydrophobic residues are buried .pdf
 
A)worst case complexityit will compare with all element .pdf
A)worst case complexityit will compare with all element .pdfA)worst case complexityit will compare with all element .pdf
A)worst case complexityit will compare with all element .pdf
 
a) Our lungs are lined with the surfactant which has phospholipid an.pdf
a) Our lungs are lined with the surfactant which has phospholipid an.pdfa) Our lungs are lined with the surfactant which has phospholipid an.pdf
a) Our lungs are lined with the surfactant which has phospholipid an.pdf
 
A four dimensional subspace cant be spanned by two vectors only. T.pdf
A four dimensional subspace cant be spanned by two vectors only. T.pdfA four dimensional subspace cant be spanned by two vectors only. T.pdf
A four dimensional subspace cant be spanned by two vectors only. T.pdf
 
12L has mass 16 grams 22.4L of gas has M mass M= .pdf
                     12L has mass 16 grams 22.4L of gas has M mass M= .pdf                     12L has mass 16 grams 22.4L of gas has M mass M= .pdf
12L has mass 16 grams 22.4L of gas has M mass M= .pdf
 
2 m5275145Solution2 m5275145.pdf
2 m5275145Solution2 m5275145.pdf2 m5275145Solution2 m5275145.pdf
2 m5275145Solution2 m5275145.pdf
 
1.Personal Trainers Inc. is about to expand its’ successful fitnes.pdf
1.Personal Trainers Inc. is about to expand its’ successful fitnes.pdf1.Personal Trainers Inc. is about to expand its’ successful fitnes.pdf
1.Personal Trainers Inc. is about to expand its’ successful fitnes.pdf
 
1) The Security wireless system is a Security technique which is use.pdf
1) The Security wireless system is a Security technique which is use.pdf1) The Security wireless system is a Security technique which is use.pdf
1) The Security wireless system is a Security technique which is use.pdf
 

Recently uploaded

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 

Recently uploaded (20)

How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 

RainfallTest.java import java.util.Arrays; import java.util.Sc.pdf

  • 1. RainfallTest.java import java.util.Arrays; import java.util.Scanner; public class RainfallTest { /** * @param args */ static String month[] = {"January", "Fabruary", "March", "April", "May", "June", "July", "August", "September","October","November","December"}; public static void main(String[] args) { // TODO Auto-generated method stub int months[] = new int[12]; Scanner scan = new Scanner(System.in); for(int i=0; i months[i]){ min = months[i]; minIndex = i; } } System.out.println("The minimum rainfall is :"+min); System.out.println("The minimum rainfall month is :"+month[minIndex]); } public static void updaeRainFallForMonth(int months[]){ Scanner scan = new Scanner(System.in); System.out.println("Enter a month (1-12) for rainfall update:"); int month = scan.nextInt(); System.out.println("Enter rainfall for update:"); int rainfall = scan.nextInt(); months[month-1] = rainfall; } public static void exit(){ System.exit(0); } }
  • 2. Output: Enter Rainfall for the month 1: 55 Enter Rainfall for the month 2: 66 Enter Rainfall for the month 3: 77 Enter Rainfall for the month 4: 44 Enter Rainfall for the month 5: 33 Enter Rainfall for the month 6: 22 Enter Rainfall for the month 7: 11 Enter Rainfall for the month 8: 99 Enter Rainfall for the month 9: 88 Enter Rainfall for the month 10: 45 Enter Rainfall for the month 11: 56 Enter Rainfall for the month 12: 67 Entered rainfall details [55, 66, 77, 44, 33, 22, 11, 99, 88, 45, 56, 67] Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 1 January: 55
  • 3. Fabruary: 66 March: 77 April: 44 May: 33 June: 22 July: 11 August: 99 September: 88 October: 45 November: 56 December: 67 Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 2 The total rainfall is :663 Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 3 The average rainfall is :55.25 Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain
  • 4. .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 4 The maximum rainfall is :99 The maximum rainfall month is :August Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 5 The minimum rainfall is :11 The minimum rainfall month is :July Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 6 Enter a month (1-12) for rainfall update: 7 Enter rainfall for update: 99 Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain.
  • 5. 6.update the amount of rain in any given month 7.quit 4 The maximum rainfall is :99 The maximum rainfall month is :July Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 7 Solution RainfallTest.java import java.util.Arrays; import java.util.Scanner; public class RainfallTest { /** * @param args */ static String month[] = {"January", "Fabruary", "March", "April", "May", "June", "July", "August", "September","October","November","December"}; public static void main(String[] args) { // TODO Auto-generated method stub int months[] = new int[12]; Scanner scan = new Scanner(System.in); for(int i=0; i months[i]){ min = months[i]; minIndex = i; }
  • 6. } System.out.println("The minimum rainfall is :"+min); System.out.println("The minimum rainfall month is :"+month[minIndex]); } public static void updaeRainFallForMonth(int months[]){ Scanner scan = new Scanner(System.in); System.out.println("Enter a month (1-12) for rainfall update:"); int month = scan.nextInt(); System.out.println("Enter rainfall for update:"); int rainfall = scan.nextInt(); months[month-1] = rainfall; } public static void exit(){ System.exit(0); } } Output: Enter Rainfall for the month 1: 55 Enter Rainfall for the month 2: 66 Enter Rainfall for the month 3: 77 Enter Rainfall for the month 4: 44 Enter Rainfall for the month 5: 33 Enter Rainfall for the month 6: 22 Enter Rainfall for the month 7: 11 Enter Rainfall for the month 8: 99 Enter Rainfall for the month 9: 88 Enter Rainfall for the month 10:
  • 7. 45 Enter Rainfall for the month 11: 56 Enter Rainfall for the month 12: 67 Entered rainfall details [55, 66, 77, 44, 33, 22, 11, 99, 88, 45, 56, 67] Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 1 January: 55 Fabruary: 66 March: 77 April: 44 May: 33 June: 22 July: 11 August: 99 September: 88 October: 45 November: 56 December: 67 Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 2
  • 8. The total rainfall is :663 Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 3 The average rainfall is :55.25 Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 4 The maximum rainfall is :99 The maximum rainfall month is :August Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 5 The minimum rainfall is :11 The minimum rainfall month is :July Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year
  • 9. 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 6 Enter a month (1-12) for rainfall update: 7 Enter rainfall for update: 99 Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 4 The maximum rainfall is :99 The maximum rainfall month is :July Enter your choice: 1.the rainfall for each month 2.the total rainfall for the year 3.find the average monthly rainfall 4.the name of the month with the most rain .5.the name of the month with the least rain. 6.update the amount of rain in any given month 7.quit 7