1 import java.util.*;
2 publicclass CALC
3 {
4 publicstaticvoid main (String[] args)
5 { int much;
6 System.out.print("\nEnter the number of numbers ");
7 Scanner input=new Scanner(System.in);
8 much=input.nextInt();
9
10
11 int[]num=newint[much];
12 double[]perc=newdouble[num.length];
13
14 int[]den=newint[num.length];
15 int total=0;
16 int total1=0;
17 int perhold,smal;
18 double smallest,highest;
19 double percent;
20 int perc1;
21 int count=0;
22 double average;
23 for(int i=0;i<=num.length-1;i++)
24 {
25 System.out.print("Enter top number "+(i+1)+ " ");
26 num=input.nextInt();
27 System.out.print("Enter the bottom number"+(i+1)+" ");
28 den=input.nextInt();
29
30 perc=(double)num/(double)den;
31 perc=perc*100;
32 perc=perc+0.5;
33 perhold=(int)perc;
34 }
35
36 total=totalfind(num);
37 total1=totalfind(den);
38 average=(double)total/(double) total1;
39 percent=average*100.00;
40 percent=percent+0.5;
41 perc1=(int)percent;
42 System.out.print(" \n Grade percent average is "+ perc1+"%");
43
44 smallest=smallfind(perc); //here is the problem
45
46
47 System.out.print("\nthe smallest percent= " + smallest);
48
49
50
51
52 }//end main metod
53 publicstaticint totalfind(int[] number)
54 {
55 int tempt;
56 int tat=0;
57 for(int i=0;i<=number.length-1;i++)
58
59 tat=tat+number;
60 tempt=tat;
61 return tempt;
62 }
63 publicstaticint total2find(int[]dem1)
64 {
65 int tempt;
66 int tat2=0;
67 for(int i=0;i<=dem1.length-1;i++)
68 tat2=tat2+dem1;
69 tempt=tat2;
70 return tempt;
71 }
72
73 publicstaticint smallfind(int[]small)
74 {
75
76 int temp;
77 int index=0;
78 temp=small[0];
79 for(int i=1;i<=small.length-1;i++)
80 if(small<temp)
81 {
82 temp=small;
83 index=i;
84 }
85 return index; //return the position of the smallest
86 }
87
88 //i supposed to find the average score percentage and lowest and highest percentage,
89
90
91
92
93
94
95
96
97
98 }
goofa 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.