
هذا الكود كامل وأمري للهـ لأني تعبت وأنا أحاول
كود PHP:
package finle.project;
import java.util.Arrays;
import javax.swing.JOptionPane;
import java.util.Scanner;
public class FinleProject
{
int size,arr;
Scanner input = new Scanner(System.in);
{
JOptionPane.showMessageDialog(null,"wellcme to my program\n"
+ " to help small compny \n" + "to test thier product");
FinleProject number = new FinleProject();
number.showDialog();
int s;
String aa=JOptionPane.showInputDialog(null," 1 :to calculate total "
+ "\n 2 :to calculate maximum "
+ "\n 3 :to calculate minmum "
+ "\n 4 :to exit");
s=Integer.parseInt(aa);
while (s!=4){
if (s==1)
total(number);
if (s==2)
maximum(number );
if (s==3)
manimum(number);
else
JOptionPane.showMessageDialog(null,"thanks for use this programm");
aa=JOptionPane.showInputDialog(null," 1 :to calculate total "
+ "\n 2 :to calculate maximum "
+ "\n 3 :to calculate minmum "
+ "\n 4 :to exit");
s=Integer.parseInt(aa);}
}
public void showDialog(){
size = new Integer(JOptionPane.showInputDialog("Enter number of month you "
+ "\n use to test your product:"));
size();
}
public void size()
{
arr = size;
int [] number = new int[arr];
System.out.println("The number of month IS "+arr);
for(int index=0;index<arr;index++)
{
System.out.print("Enter number of product in" + size +" months by press ENTER");
number[index]=input.nextInt();
}
}
public static int total (int[] number)
{int tot=0;
for (int arr:number)
tot+=arr;
System.out.printf("total of product is : %d\n",tot);
return tot;
}
public static int maximum ( int[] number )
{
int max = number[0];
for (int c=1; c< number.length; c++)
{ if (max< number[c])
max=number[c];
}
return max;
}
public static int manimum ( int[] number )
{
int main = number[0];
for (int c=1; c< number.length; c++)
{ if (main > number[c])
main=number[c];
}
return main;
}
}
|
شوفي أنا حليت مشكلة الميثود و إن شاء الله صح بس في مشكلة في الفاريبل number
حاولي تعدليه لاني ماني عارف اش عمله في البروجيكت
هذا الكود
كود PHP:
public class FinleProject
{
int size,arr;
Scanner input = new Scanner(System.in);
{
JOptionPane.showMessageDialog(null,"wellcme to my program\n"
+ " to help small compny \n" + "to test thier product");
FinleProject number = new FinleProject();
number.showDialog();
int s;
String aa=JOptionPane.showInputDialog(null," 1 :to calculate total "
+ "\n 2 :to calculate maximum "
+ "\n 3 :to calculate minmum "
+ "\n 4 :to exit");
s=Integer.parseInt(aa);
while (s!=4){
if (s==1)
total(number);
if (s==2)
maximum(number );
if (s==3)
manimum(number);
else
JOptionPane.showMessageDialog(null,"thanks for use this programm");
aa=JOptionPane.showInputDialog(null," 1 :to calculate total "
+ "\n 2 :to calculate maximum "
+ "\n 3 :to calculate minmum "
+ "\n 4 :to exit");
s=Integer.parseInt(aa);}
}
public void showDialog(){
size = new Integer(JOptionPane.showInputDialog("Enter number of month you "
+ "\n use to test your product:"));
size();
}
public void size()
{
arr = size;
int [] number = new int[arr];
System.out.println("The number of month IS "+arr);
for(int index=0;index<arr;index++)
{
System.out.print("Enter number of product in" + size +" months by press ENTER");
number[index]=input.nextInt();
}
}
public int total (int[] number)
{int tot=0;
for (int arr:number)
tot+=arr;
System.out.printf("total of product is : %d\n",tot);
return tot;
}
public int maximum ( int[] number )
{
int max = number[0];
for (int c=1; c< number.length; c++)
{ if (max< number[c])
max=number[c];
}
return max;
}
public int manimum ( int[] number )
{
int main = number[0];
for (int c=1; c< number.length; c++)
{ if (main > number[c])
main=number[c];
}
return main;
}
}
اذا في مشكله اكتبيها و ان شاء الله احاول احلها