Aoua's Profile
Reputation: 0
Apprentice
- Group:
- Members
- Active Posts:
- 17 (0.05 per day)
- Joined:
- 07-July 12
- Profile Views:
- 309
- Last Active:
Aug 05 2012 08:49 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: deposit program,BankAccount
Posted 4 Aug 2012
pbl, on 04 August 2012 - 09:17 AM, said:Not sure of that formula at all
public double calcMoneyAfterNYears(int n){ return this.amount * Math.pow(this.intrestRate / 100 + 1.0, n); }
the interest should be compound year after year. I think it should rather look like
public double calcMoneyAfterNYears(int n){ double calculatedAmount = amount; for(int year = 0; year < n; ++year) calculatedAmount += (calculatedAmount * interestRate); return calculatedAmount; }
dear sir thank you it vas very helpful tnx
but here as part B said:
take the same problem, but this time, you should write a java code, that calculate the number of years, after what the FinAmount becomes the double of IniAmount.
now in my code its given me 1 year
public int numberOfYearsTillDoubled(){ int n = 0; double tempAmount = 0.0; while(true){ tempAmount = this.calcMoneyAfterNYears(n); if(tempAmount >= this.amount * 2){ break; } n++; } return n; }
i think the output should be like :
Initial Amount : 100.0 Double Amount : 200.0 Interest Rate : 6.0 Number of years required to double the initial amount : 12 "
any idea please!
thanks again -
In Topic: square matrices
Posted 2 Aug 2012
any psedu code?! -
In Topic: calc program
Posted 17 Jul 2012
the problem he asked enter 10 Numbers (out of hundred), means the entered number between 1 and 100,
but my program accept the number which is > 100 and <0
-
In Topic: calc program
Posted 17 Jul 2012
my code working but i have problem in enter 10 Numbers (out of hundred),
import javax.swing.*; public class JavaApplication2 { public static void main(String[] args){ double[] anArray = new double[10]; for(int i=0; i<anArray.length; i++) { anArray[i]=Integer.parseInt(JOptionPane.showInputDialog("please enter a number")); } // 1- write the largest grade double max = anArray[0]; for(int x=1; x<anArray.length; x++) { if(max<anArray[x]) max=anArray[x]; } System.out.println("the largest grade is " + max); // 2- write the smaller grade double min= anArray[0]; for(int y=0; y<anArray.length; y++) { if(min>anArray[y]) min=anArray[y]; } System.out.println("the smaller grade is " + min); // 3- the average of all grade double sum=0; for(int z=0; z<anArray.length; z++) { sum = sum+ anArray[z]; } System.out.println("the average of all grade is " + sum/anArray.length); // 4- the number of grade less than 50 for(int a=0; a<anArray.length; a++) { if(anArray[a] < 50) System.out.println(anArray[a]); } } } -
In Topic: calc program
Posted 17 Jul 2012
Aoua, on 17 July 2012 - 01:01 AM, said:dear..
i need help to solve this problem
write a program to enter 10 Numbers (out of hundred), then find the following:
1- The largest Number
2- The smallest Number
3- The average of all the Number
4- The number of Numbers less than 50.
herethe first step, program to enter 10 Numbers (out of hundred),
this my code when enter the number accept number which >100 ?!
import javax.swing.*; import java.util.*; public class q { public static void main(String[] args) { //System.out.print("entern bettwen 1 and 100 "); //Scanner sc=new Scanner(System.in); //int input=sc.nextInt(); int i=1; String input=JOptionPane.showInputDialog("Please enter a number between 1 - 100:"); int sc=Integer.parseInt(input); if((sc>0)||(sc<=100)){ while(i<=10) JOptionPane.showInputDialog(null,"enter num"); System.out.println(i); i++; } } }

this my full program but need the, first step, program to enter 10 Numbers (out of hundred),
import javax.swing.*; public class JavaApplication2 { public static void main(String[] args){ double[] anArray = new double[10]; for(int i=0; i<anArray.length; i++) { anArray[i]=Integer.parseInt(JOptionPane.showInputDialog("please enter a number")); } // 1- write the largest grade double max = anArray[0]; for(int x=1; x<anArray.length; x++) { if(max<anArray[x]) max=anArray[x]; } System.out.println("the largest grade is " + max); // 2- write the smaller grade double min= anArray[0]; for(int y=0; y<anArray.length; y++) { if(min>anArray[y]) min=anArray[y]; } System.out.println("the smaller grade is " + min); // 3- the average of all grade double sum=0; for(int z=0; z<anArray.length; z++) { sum = sum+ anArray[z]; } System.out.println("the average of all grade is " + sum/anArray.length); // 4- the number of grade less than 50 for(int a=0; a<anArray.length; a++) { if(anArray[a] < 50) System.out.println(anArray[a]); } } }
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
|
|


Find Topics
Find Posts
View Reputation Given

|
Comments
Aoua has no profile comments yet. Why not say hello?