hey guys this is my program ,every thing works great but i want to to make aloop which makes the program play again,idon't know how to do that for multi methods program can some one help me.
i know i have to create string and use that to loop the program but still i can't figure out how to do that for more than one method:?:

thanks;)

ah i forgot to put the program sorry;
#
1 import java.util.*;
2 public class CALC
3 {
4
5
6
7
8 public static void main (String[] args)
9 {
10
11 int much;
12 System.out.print("\nEnter the number of numbers ");
13 Scanner input=new Scanner(System.in);
14 much=input.nextInt();
15
16
17 int[]num=new int[much];
18 double[]perc=new double[num.length];
19 int[]amount=new int[num.length];
20 int[]den=new int[num.length];
21 double[]pos=new double[num.length];
22 int total=0;
23 int total1=0;
24 int perhold,smal;
25 int smallest,highest;
26 int high,small;
27 double scoreA;
28 double scoreB;
29 double percent;
30 int perc1;
31 int count=0;
32 double average;
33 for(int i=0;i<=num.length-1;i++)
34 {
35 System.out.print("Enter top number "+(i+1)+ " ");
36 num=input.nextInt();
37 System.out.print("Enter the bottom number"+(i+1)+" ");
38 den=input.nextInt();
39
40 perc=(double)num/(double)den;
41 perc=perc*100;
42 perc=perc+0.5;
43 amount=(int)perc;
44 }
45
46 total=totalfind(num);
47 total1=totalfind(den);
48 average=(double)total/(double) total1;
49 percent=average*100.00;
50 percent=percent+0.5;
51 perc1=(int)percent;
52
53 smallest=smallfind(amount);
54 highest=highestfind(amount);
55 small=amount[smallest];
56 high=amount[highest];
57 if(perc1<=59)
58 System.out.print(" \nThere were "+much+" grades entred with an average grade of "+ perc1+"%"+" which is a "+"'F'.");
59
60 else
61 if(perc1>=60&&perc1<=69)
62 System.out.print(" \nThere were "+much+" grades entred with an average grade of "+ perc1+"%"+" which is a "+"'D'.");
63 else
64 if(perc1>=70&&perc1<=79)
65 System.out.print(" \nThere were "+much+" grades entred with an average grade of "+ perc1+"%"+" which is a "+"'C'.");
66 else
67 if(perc1>=80&&perc1<=89)
68 System.out.print(" \nThere were "+much+" grades entred with an average grade of "+ perc1+"%"+" which is a "+"'B'.");
69 else
70 if(perc1>=90)
71 System.out.print(" \nThere were "+much+" grades entred with an average grade of "+ perc1+"%"+" which is a "+"'A'.");
72
73
74
75 System.out.print("\nThe highest grade was "+num[highest]+"/"+den[highest]+ " which is a percent score of "+high+"%.");
76 System.out.print("\nThe lowest grade was "+num[smallest]+"/"+den[smallest] +" which is a percent score of " +small+"%." );
77
78
79 }//end main metod
80 public static int totalfind(int[] number)
81 {
82 int tempt;
83 int tat=0;
84 for(int i=0;i<=number.length-1;i++)
85
86 tat=tat+number;
87 tempt=tat;
88 return tempt;
89 }
90 public static int total2find(int[]dem1)
91 {
92 int tempt;
93 int tat2=0;
94 for(int i=0;i<=dem1.length-1;i++)
95 tat2=tat2+dem1;
96 tempt=tat2;
97 return tempt;
98 }
99
100 public static int smallfind(int[]small)
101 {
102
103 int temp;
104 int index=0;
105 temp=small[0];
106 for(int i=0;i<=small.length-1;i++)
107 if(small<temp)
108 {
109 temp=small;
110 index=i;
111 }
112 return index;
113 }
114 public static int highestfind(int[]high)
115 {
116 int temp;
117 int index=0;
118 temp=high[0];
119 for(int i=0;i<=high.length-1;i++)
120 if(high>temp)
121 {
122 temp=high;
123 index=i;
124 }
125 return index;
126 }
127
128
129
130 3
131
132
133
134
135
136
137 }

Technically you'd need to have something else do that.
You can't loop the entire program from within the program, for what would loop the loop?

So you'd need either some sort of wrapper around it that's not part of the program, or put the entire thing into a task scheduler (like cron on Unix machines).

Please don't double post, I already told you what is wrong with your code and sent it PM to you and you IGNORED

  1. two main things to use hash to post your code
  2. follow JAVA convension on namig classes and methods.

Plus other things

This article has been dead for over six months. Start a new discussion instead.