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 }

First thing first, when you copy and paste code can you please use tag for inserting code into post, which is the hash "#" sign on the toolbar for creating post. Thank you
Secondly please follow JAVA coding standarts, there are not there just for fun

  1. class naming CALC should be Calc or if you wish MyCalculationProgram
  2. methods totalfind should be totalFind

Third, what is purpose of for loop on lines 57, 67 & 79? They do actualy nothing, either put there braclets and some code between them or delete for loops
Fourth method smallfind is supposed to return the smallest percantage in your array, that is what you expect on line 44, in reality however you sending index position in the array not actual value from that position(line 83 assign array position to index, line 85 return this value)

i am new at programing this is my frist month,
For line57,67 & 79 ;that is to limit the array to the numbers of position that the user entered.
and for returning index position is because i want the smallest percentage and the smallest score e.g:the lowest score is 12/50 which is ...%
and thank you

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.