SlideShare a Scribd company logo
1 of 9
Download to read offline
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.pdfanithareadymade
 
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.pdfanithareadymade
 
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 .pdfanithareadymade
 
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.pdfanithareadymade
 
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.pdfanithareadymade
 
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 .pdfanithareadymade
 
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.pdfanithareadymade
 
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.pdfanithareadymade
 
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 .pdfanithareadymade
 
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.pdfanithareadymade
 
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.pdfanithareadymade
 
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.pdfanithareadymade
 
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 .pdfanithareadymade
 
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 .pdfanithareadymade
 
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.pdfanithareadymade
 
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.pdfanithareadymade
 
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= .pdfanithareadymade
 
2 m5275145Solution2 m5275145.pdf
2 m5275145Solution2 m5275145.pdf2 m5275145Solution2 m5275145.pdf
2 m5275145Solution2 m5275145.pdfanithareadymade
 
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.pdfanithareadymade
 
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.pdfanithareadymade
 

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

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonhttgc7rh9c
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfstareducators107
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 

Recently uploaded (20)

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 

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