 Programming Forums

Community for Java, PHP, Perl C, ASP and Python programmers
Monday 17 June 2019 17:49

Array Problems

Author Message
mario.beka
Guest Programmer

Hey everybody, I'm trying to make a program that calculates the salary of a person in two variants for 25 years.

After doing that i need to show in the end which variant is better and from which year.

until now i can just do the array, but i cannot figure out how to show compare this 2 arrays.
this is my code so far.

 Code: public class Lohnerhohung {      public static void main(String[] args){         double kapitalA=1200,kapitalB=1200;         double sumA = 0,sumB= 0;         double []varianteA= new double;         double []varianteB= new double;         int i=0;         System.out.println("Year | Year A | Sum A | Year B | Sum B");         for (i=0;i<25>kapitalB){          System.out.println("A is greater"+varianteA[i]+"from year"+i);}     }     }

I need some help with this....

mario.beka
Guest Programmer

mario.beka wrote:
Hey everybody, I'm trying to make a program that calculates the salary of a person in two variants for 25 years.

After doing that i need to show in the end which variant is better and from which year.

until now i can just do the array, but i cannot figure out how to show compare this 2 arrays.
this is my code so far.

 Code: public class Lohnerhohung {      public static void main(String[] args){         double kapitalA=1200,kapitalB=1200;         double sumA = 0,sumB= 0;         double []varianteA= new double;         double []varianteB= new double;         int i=0;         System.out.println("Year | Year A | Sum A | Year B | Sum B");            if(varianteA[i]>kapitalB){          System.out.println("A is greater"+varianteA[i]+"from year"+i);}     }     }

I need some help with this....

sorry guys this is the real code...

 Code: public class Lohnerhohung {      public static void main(String[] args){         double kapitalA=1200,kapitalB=1200;         double sumA = 0,sumB= 0;         double []varianteA= new double;         double []varianteB= new double;         int i=0;         System.out.println("Year | Year A | Sum A | Year B | Sum B");         for (i=0;i<25>kapitalB){          System.out.println("A is greater"+varianteA[i]+"from year"+i);}     }     }

[/code]

 Page 1 of 1 