Java:erreur lors de compilation

Fermé
domxaline - 28 mars 2012 à 13:55
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 - 29 mars 2012 à 15:14
Bonjour,
j'écris ce prg,pendant le compilation me donne une erreur,quelqu'un peut m'aider svp
import java.io.*;
public class Account 
{
 String custName; 
 String accNo;  
 String amount;
 double balance;
 public void input()
 {
     try
     {
         BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
         System.out.println("Enter the name of a account holder");
         custName=br.readLine();
         System.out.println("Enter the account number of a account holder");
         accNo=br.readLine();
         System.out.println("Enter the amount to be deposited");
         balance=Double.parseDouble(amount);
     }
     catch(Exception g)
     { 
     
     }
 }
 public void deposit()
 {
     try
     {
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
         System.out.println("Enter the amount to be deposited");
         amount=br.readLine();
         double amt=Double.parseDouble(amount);
         balance=balance+amt;
         System.out.println("Balance: "+balance);
     }
     catch(IOException e)
     { 
     }}
 public void withdraw()
 {
     try
     {
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
          System.out.println("Enter the amount to be withdraw1");
          amount=br.readLine();
          double amt=Double.parseDouble(amount);
          balance=balance-amt;
          System.out.println("balance: "+balance);
     }
     catch(IOException e)
     {
     }}
 public void display()
 {
  System.out.println("Account holder details");
   System.out.println("----------------------");
    System.out.println("Name: "+custName);
     System.out.println("Balance: "+balance);
 }}


public class Current extends Account
{
    public void chequebook()
    {
        if (balance<1000)
             System.out.println("cheque book has not been issued");
        else
         System.out.println("chèque book has been issued");
    }
    public void minimumBal()
    {
        double penalty=1000;
        if(balance<10000)
        {
            balance=balance-penalty;
        }   
    }
    public void display()
    {
     minimumBal();
     super.display();
    }
}

import java.io.*;
public class Saving1 
{
  public static void main(String a[])
{
char choice;
Saving1 obj=new Saving1();
while(true)
{
 choice = obj.menu();
 try
{
 switch(choice)
 {
 case '1':Current object=new Current();
 while(true)
 {
  System.out.println("Menu");
  System.out.println("1. Enter Details");
  System.out.println("2. Deposit Amount");
  System.out.println("3. Withdraw Amount");
  System.out.println("4. Display Balance");
  System.out.println("5. Issue ChequeBook");
  System.out.println("6. Exit");
try
{
 System.out.println("Enter your choice(1-6)");
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 char ch=(char)br.read();
 switch(ch)
 {
  case '1':object.input();
  break;
  case '2':object.deposit();
  break;
  case '3':
  object.withdraw();
  break;
  case '4':object.display();
  break;
  case '5':object.chequebook();
  break;
  case '6':choice = obj.menu();
  default:
  System.out.println("Please Enter the valid choice");
  break;
}
}
catch(IOException e)
{
}
}
case '2':
Saving object1=new Saving();
while(true)
{
  System.out.println("Menu");
  System.out.println("1. Enter Details");
  System.out.println("2. Deposit Amount");
  System.out.println("3. Withdraw Amount");
  System.out.println("4. Display Balance");
  System.out.println("5. Exit");
try
{
 System.out.println("Enter your choice(1-4)");
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 char ch=(char)br.read();
 switch(ch){case '1':
 object1.input();break;
 case '2':object1.deposit();
 break;
 case '3':object1.withdraw();
 break;
 case '4':object1.display();
 break;
 case '5':obj.menu();
 default:
 System.out.println("Please enter the valid choice");
 break;
}
}
catch(Exception e)
{
}
}
case '3'://System.out.println("Please enter the valid choice");
System.exit(0);
break;
}
 //switch
}
catch(Exception e)
{}
}
 //while
}
 //main}  

}


lors de compilations j'ai l'erreur suivante:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Saving1.menu
at Saving1.main(Saving1.java:10)

aidez moi svp

A voir également:

11 réponses

poukkid Messages postés 106 Date d'inscription mercredi 20 mai 2009 Statut Membre Dernière intervention 11 avril 2012 11
28 mars 2012 à 14:32
Salut

Deja il n'y a pas d'erreurs dans tes deux classes Account et Current, mais a condition que tu les définisse chacune dans leur fichier respectif (les 3 classes que tu a copié collé ne sont pas dans le meme fichier j'espere?)

Ensuite tu n'as pas de méthode
menu()
dans ta classe saving donc la ligne 13 de la classe Saving :
choice = obj.menu();

renvoie naturellement une erreur

Idem dans les switch suivants où tu essayes d'appeler cette méthode
menu()


Enfin tu a l'air d'avoir confondu tes classes Saving et Current puisque tu crées à la ligne 56 de la classe Saving un nouvel objet de type Saving :
case '2':
					Saving object1=new Saving();


Mais tu cherches à appeler les methodes deposit(), withdraw(), display()... dessus, donc a priori tu devrais changer
Saving object1=new Saving();
en
Current object1 = new Current();
.
0
ok, j'ai corrigé ainsi,mais quand même dans le résultat, je crois il y a un pb
qu'en pensez vous
import java.io.*;
public class Account 
{
 String custName; 
 String accNo;  
 String amount;
 double balance;
 public void input()
 {
     try
     {
         BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
         System.out.println("Enter the name of a account holder");
         custName=br.readLine();
         System.out.println("Enter the account number of a account holder");
         accNo=br.readLine();
         System.out.println("Enter the amount to be deposited");
         balance=Double.parseDouble(amount);
     }
     catch(Exception g)
     { 
     
     }
 }
 public void deposit()
 {
     try
     {
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
         System.out.println("Enter the amount to be deposited");
         amount=br.readLine();
         double amt=Double.parseDouble(amount);
         balance=balance+amt;
         System.out.println("Balance: "+balance);
     }
     catch(IOException e)
     { 
     }}
 public void withdraw()
 {
     try
     {
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
          System.out.println("Enter the amount to be withdraw1");
          amount=br.readLine();
          double amt=Double.parseDouble(amount);
          balance=balance-amt;
          System.out.println("balance: "+balance);
     }
     catch(IOException e)
     {
     }}
 public void display()
 {
  System.out.println("Account holder details");
  System.out.println("----------------------");
  System.out.println("Name: "+custName);
  System.out.println("Balance: "+balance);
 }}

public class Current extends Account
{
    public void chequebook()
    {
        if (balance<1000)
             System.out.println("cheque book has not been issued");
        else
         System.out.println("chèque book has been issued");
    }
    public void minimumBal()
    {
        double penalty=1000;
        if(balance<10000)
        {
            balance=balance-penalty;
        }   
    }
    public void display()
    {
     minimumBal();
     super.display();
    }
}

import java.io.*;
public class Saving extends Account
{
    public void calInterest()
    {
        double interest=0;
        System.out.println(interest);
        balance=balance*Math.pow(1.05, 2);
        System.out.println(balance);
    }
        public void display()
        {
            calInterest();
             System.out.println(balance);
             super.display();
        }
        public char menu()
        {
          char choice='a';
          System.out.println("Menu");
          System.out.println("1.Current account");
          System.out.println("2.Savings account");
          System.out.println("3.exit");
          System.out.println("Enter your choice (1-3)");
        try
        {
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
         choice=(char)br.read();
        }
        catch(Exception e)
        {
             System.out.println("Error");
        }
        if (choice=='3')
        {
             System.exit(0);
        }
        return choice;
        }
        public static void main (String a [])
        {
            char choice;
            Saving o=new Saving();
            while(true)
            {
                choice=o.menu();
                try
                {
                 switch(choice)
                 {
                  case '1': Current object=new Current();
                  while(true)
                  {
                   System.out.println("menu"); 
                   System.out.println("1.enter details");
                   System.out.println("2.deposit amount");
                   System.out.println("3.withdraw amount");
                   System.out.println("4.display balance");
                   System.out.println("5.issue chequeBook");
                   System.out.println("6.exit");
                try
                  {
                   System.out.println("enter your choice(1-6)");
                   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                   char ch=(char)br.read();
                   switch(ch)
                   {
                    case'1':object.input();
                    break;
                    case'2':object.deposit();
                    break;
                    case'3':object.withdraw();
                    break;
                    case'4':object.display();
                    break;
                    case'5':object.chequebook();
                    break;
                    case'6':choice=o.menu();
                    default:
                    System.out.println("Please enter the valid choice");
                    break;             
                    }
                    }
               catch(IOException e)
               {
               }                              
               }
         case'2':
               Saving object1=new Saving();
               while(true)
               {
                System.out.println("Menu");
                System.out.println("1. Enter Details");
                System.out.println("2. Deposit Amount");
                System.out.println("3. Withdraw Amount");
                System.out.println("4. Display Balance");
                System.out.println("5. Exit");
           try
           {
             System.out.println("enter your choice(1-6)");
             BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
             char ch=(char)br.read();
             switch(ch)
             {
              case'1':object1.input();
              break;
              case'2':object1.deposit();
              break;
              case'3':object1.withdraw();
              break;
              case'4':object1.display();
              break;
              case'5':o.menu();
              default:
              System.out.println("please enter the valid choice");
              break;
}}
    catch(IOException e)
    {
    }
    }
    case'3'://System.out.println("please entre the valid choice");
    System.exit(0);
    break;
    }
    //switch
    }
    catch(Exception e)
    {
    }
            }
}//while

}//main

import java.io.*;
public class Saving1 extends Saving
{
  public static void main(String a[])
{
char choice;
Saving o=new Saving();
while(true)
{
 choice = o.menu();
 try
{
 switch(choice)
 {
 case '1':Current object=new Current();
 while(true)
 {
  System.out.println("Menu");
  System.out.println("1. Enter Details");
  System.out.println("2. Deposit Amount");
  System.out.println("3. Withdraw Amount");
  System.out.println("4. Display Balance");
  System.out.println("5. Issue ChequeBook");
  System.out.println("6. Exit");
try
{
 System.out.println("Enter your choice(1-6)");
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 char ch=(char)br.read();
 switch(ch)
 {
  case '1':object.input();
  break;
  case '2':object.deposit();
  break;
  case '3':object.withdraw();
  break;
  case '4':object.display();
  break;
  case '5':object.chequebook();
  break;
  case '6':choice = o.menu();
  default:
  System.out.println("Please Enter the valid choice");
  break;
}
}
catch(IOException e)
{
}
}
case '2':
Current object1=new Current();
while(true)
{
  System.out.println("Menu");
  System.out.println("1. Enter Details");
  System.out.println("2. Deposit Amount");
  System.out.println("3. Withdraw Amount");
  System.out.println("4. Display Balance");
  System.out.println("5. Exit");
try
{
 System.out.println("Enter your choice(1-4)");
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 char ch=(char)br.read();
 switch(ch){case '1':
 object1.input();break;
 case '2':object1.deposit();
 break;
 case '3':object1.withdraw();
 break;
 case '4':object1.display();
 break;
 case '5':o.menu();
 default:
 System.out.println("Please enter the valid choice");
 break;
}
}
catch(Exception e)
{
}
}
case '3'://System.out.println("Please enter the valid choice");
System.exit(0);
break;
}
 //switch
}
catch(Exception e)
{}
}
 //while
}
 //main} 
}


0
KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015
28 mars 2012 à 18:32
"je crois il y a un pb" : lequel ?
ça compile, ça s'exécute, alors quoi ?
0
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 10
Modifié par domxaline le 29/03/2012 à 10:05
ok,j'ai compris
mais je viens d'ajouter un constructor dans le class account,
après avoir ajouter constructor,lors de la execution j'ai une erreur
suivantes:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Account.<init>
at Saving.<init>(Saving.java:2)
at Saving.main(Saving.java:43)

import java.io.*;    
public class Account     
{    
 String custName;     
 String accNo;      
 String amount;    
 double balance;   
     
 Account(String h,String i,String j,double k)    
 {    
  custName=h;    
  accNo=i;      
  amount=j;    
  balance=k;    
 }    
 public void input()    
 {    
     try    
     {    
         BufferedReader br=new BufferedReader (new InputStreamReader(System.in));    
         System.out.println("Enter the name of a account holder");    
         custName=br.readLine();    
         System.out.println("Enter the account number of a account holder");    
         accNo=br.readLine();    
         System.out.println("Enter the amount to be deposited");    
         balance=Double.parseDouble(amount);    
     }    
     catch(Exception g)    
     {     
         
     }    
 }    
 public void deposit()    
 {    
     try    
     {    
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));    
         System.out.println("Enter the amount to be deposited");    
         amount=br.readLine();    
         double amt=Double.parseDouble(amount);    
         balance=balance+amt;    
         System.out.println("Balance: "+balance);    
     }    
     catch(IOException e)    
     {     
     }}    
 public void withdraw()    
 {    
     try    
     {    
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));    
          System.out.println("Enter the amount to be withdraw1");    
          amount=br.readLine();    
          double amt=Double.parseDouble(amount);    
          balance=balance-amt;    
          System.out.println("balance: "+balance);    
     }    
     catch(IOException e)    
     {    
     }}    
 public void display()    
 {    
  System.out.println("Account holder details");    
  System.out.println("----------------------");    
  System.out.println("Name: "+custName);    
  System.out.println("Balance: "+balance);    
 }}    

import java.io.*;    
public class Current extends Account
{    
    public void chequebook()    
    {    
        if (balance<1000)    
             System.out.println("cheque book has not been issued");    
        else    
         System.out.println("chèque book has been issued");    
    }    
    public void minimumBal()    
    {    
        double penalty=1000;    
        if(balance<10000)    
        {    
            balance=balance-penalty;    
        }       
    }    
    public void display()    
    {    
     minimumBal();    
     super.display();    
    }    
}    
            
import java.io.*;    
public class Saving extends Account
{    
    public void calInterest()    
    {    
        double interest=0;    
        System.out.println(interest);    
        balance=balance*Math.pow(1.05, 2);    
        System.out.println(balance);    
    }    
        public void display()    
        {    
            calInterest();    
             System.out.println(balance);    
             super.display();    
        }    
        public char menu()    
        {    
          char choice='a';    
          System.out.println("Menu");    
          System.out.println("1.Current account");    
          System.out.println("2.Savings account");    
          System.out.println("3.exit");    
          System.out.println("Enter your choice (1-3)");    
        try    
        {    
         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));    
         choice=(char)br.read();    
        }    
        catch(Exception e)    
        {    
             System.out.println("Error");    
        }    
        if (choice=='3')    
        {    
             System.exit(0);    
        }    
        return choice;    
        }    
        public static void main (String a [])    
        {    
            char choice;    
            Saving o=new Saving();    
            while(true)    
            {    
               choice=o.menu();    
                try    
                {    
                 switch(choice)                   
               {    
                  case '1': Current object=new Current();    
                  while(true)    
                  {    
                   System.out.println("menu");     
                   System.out.println("1.enter details");    
                   System.out.println("2.deposit amount");    
                   System.out.println("3.withdraw amount");    
                   System.out.println("4.display balance");    
                   System.out.println("5.issue chequeBook");    
                   System.out.println("6.exit");    
                try    
                  {    
                   System.out.println("enter your choice(1-6)");    
                   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));    
                   char ch=(char)br.read();    
                   switch(ch)    
                   {    
                    case'1':object.input();    
                    break;    
                    case'2':object.deposit();    
                    break;    
                    case'3':object.withdraw();    
                    break;    
                    case'4':object.display();    
                    break;    
                    case'5':object.chequebook();    
                    break;    
                    case'6':choice=o.menu();    
                    default:    
                    System.out.println("Please enter the valid choice");    
                    break;                 
                    }    
                    }    
               catch(IOException e)    
               {    
               }                                  
               }    
         case'2':    
               Saving object1=new Saving();    
               while(true)    
               {    
                System.out.println("Menu");    
                System.out.println("1. Enter Details");    
                System.out.println("2. Deposit Amount");    
                System.out.println("3. Withdraw Amount");    
                System.out.println("4. Display Balance");    
                System.out.println("5. Exit");    
           try    
           {    
             System.out.println("enter your choice(1-6)");    
             BufferedReader br=new BufferedReader(new InputStreamReader(System.in));    
             char ch=(char)br.read();    
             switch(ch)    
             {    
              case'1':object1.input();    
              break;    
              case'2':object1.deposit();    
              break;    
              case'3':object1.withdraw();    
              break;    
              case'4':object1.display();    
              break;    
              case'5':o.menu();    
              default:    
              System.out.println("please enter the valid choice");    
              break;    
}}    
    catch(IOException e)    
    {    
    }    
    }    
    case'3'://System.out.println("please entre the valid choice");    
    System.exit(0);    
    break;    
    }    
    //switch    
    }    
    catch(Exception e)    
    {    
    }    
            }    
}//while    

}//main    

dan le prg les lignes soulignés sont des lignes erreur indiqué
0
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 10
29 mars 2012 à 10:54
import java.io.*;
public class Account 
{
 String custName; 
 String accNo;  
 String amount;
 double balance;
 
 Account(String h,String i,String j,double k)
 {
  custName=h;
  accNo=i;  
  amount=j;
  balance=k;
 }

maintenant j'ai l'erreur suivante:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - constructor Saving in class Saving cannot be applied to given types;
required: double,double
found: no arguments
reason: actual and formal argument lists differ in length
at Saving.main(Saving.java:50)
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
poukkid Messages postés 106 Date d'inscription mercredi 20 mai 2009 Statut Membre Dernière intervention 11 avril 2012 11
Modifié par poukkid le 29/03/2012 à 11:42
Tu n'as pas de constructeur dans ta classe Current, ni Saving, donc ces deux classes vont utiliser le constructeur par défaut et celui ci va appeler la méthode super() pour appeler le constructeur par défaut de ta classe mère.
Or dans ta classe mère (account) tu as redéfini un constructeur avec 4 parametres et tu n'as pas redéfini de constructeur sans paramètre.

l faut que tu redéfinisse le constructeur sans paramètre dans ta classe account :
      public Account(){ 
  custName = null; 
  accNo = null; 
  amount = null; 
  balance = 0; 
 }


ou bien même simplement
public Account(){ 
}


(mais il vaut mieux initialiser tes attributs sans ça tu vas avoir des surprises)

Tu peux également le faire en ajoutant un constructeur par défaut dans tes classes current et saving :
public Current(){ 
super(null, null, null, 0); 
}


ou bien un constructeur avec des parametres qui appele lui-meme le constructeur avec parametre de ta classe Account :
  
public Current(String h, String i, String j, double k) { 
  super(h, i, j, k); 
 } 





Quel éditeur utilises tu pour coder ? eclipse t'indique ce genre d'erreurs a la volée et te permet de générer simplement le code nécessaire, ou au moins les indications à suivre.
0
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 10
29 mars 2012 à 12:52
netbeans 7.0.0
0
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 10
Modifié par domxaline le 29/03/2012 à 13:38
pas d'erreur dans la class Account
import java.io.*;  
public class Account   
{  
 String custName;   
 String accNo;    
 String amount;  
 double balance;  
   
 //Account(String h,String i,String j,double k)  
 Account ()  
 {  
  custName=null;  
  accNo=null;    
  amount=null;  
  balance=0;  
 }  


la ligne qui est dans le body de constructor est souligné
en mettant la curseur de la souris sur la ligne s'affiche message suivante:
reason:actual and formal argument list differ in length
import java.io.*;  
public class Current extends Account  
{  
    /*Current(String h,String i,String j,String k)  
    {  
      super(h,i,j,k);      
    }*/  
    Current()  
    {  
     super(null,null,null,0);
    }  


la ligne qui est dans le body de constructor est souligné
en mettant la curseur de la souris sur la ligne s'affiche message suivante:
reason:actual and formal argument list differ in length
import java.io.*;  
public class Saving extends Account  
{  
    Saving()  
    {  
     super(null,null,null,0);  
    }  
    /*Saving(String h,String i,String j,String k)  
    {  
      super(h,i,j,k);      
    }*/  
0
poukkid Messages postés 106 Date d'inscription mercredi 20 mai 2009 Statut Membre Dernière intervention 11 avril 2012 11
Modifié par poukkid le 29/03/2012 à 14:19
Il faut faire l'un ou l'autre!!


Soit
tu déclares un deuxieme constructeur dans ta classe account avec aucun parametre donc ta classe account commencera par
import java.io.*;    
public class Account     
{    
 String custName;     
 String accNo;      
 String amount;    
 double balance;    
     
 Account(String h,String i,String j,double k)  {  
  custName = h;  
  accNo = i;  
  amount = j;  
  balance = k;  
}  
 Account ()    
 {    
  custName=null;    
  accNo=null;      
  amount=null;    
  balance=0;    
 }  


et dans ce cas tu n'as pas besoin de rajouter de constructeur dans tes deux classes Current et Saving



Soit tu laisse la classe Account comme elle est avec un seul constructeur avec 4 parametres :
Account(String h,String i,String j,double k)  {  
  custName = h;  
  accNo = i;  
  amount = j;  
  balance = k;  
}


et dans ce cas tu dois créer un constructeur par classe fille Current et Saving.

et ce constructeur doit appeler la méthode super avec en parametres 3 objet de type string et un objet de type double

/!\ Attention car tu as essayé de faire des constructeurs avec 4 objets de type string, je te cite :
/*Saving(String h,String i,String j,String k)    
    {    
      super(h,i,j,k);        
    }*/  
ce qui ne marchera pas puisque l'appel a super() doit prendre 3 string et un double
0
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 10
29 mars 2012 à 14:55
merci beaucoup j'ai pris premier solution,mais prg me donnes un résultat fausse;quand je demande display balance,il me donne fausse resultat!!!
car je depose 4000,et je retire 200,il me restera que 3800
mais il me montre Balance: 4189.5 !!!!
Menu
1.Current account
2.Savings account
3.exit
Enter your choice (1-3)
2
Menu
1. Enter Details
2. Deposit Amount
3. Withdraw Amount
4. Display Balance
5. Exit
enter your choice(1-6)
1
Enter the name of a account holder
xavier
Enter the account number of a account holder
26
Enter the amount to be deposited
Menu
1. Enter Details
2. Deposit Amount
3. Withdraw Amount
4. Display Balance
5. Exit
enter your choice(1-6)
2
Enter the amount to be deposited
4000
Balance: 4000.0
Menu
1. Enter Details
2. Deposit Amount
3. Withdraw Amount
4. Display Balance
5. Exit
enter your choice(1-6)
3
Enter the amount to be withdraw1
200
balance: 3800.0
Menu
1. Enter Details
2. Deposit Amount
3. Withdraw Amount
4. Display Balance
5. Exit
enter your choice(1-6)
4
0.0
4189.5
4189.5
Account holder details
----------------------
Name: xavier
Balance: 4189.5
Menu
1. Enter Details
2. Deposit Amount
3. Withdraw Amount
4. Display Balance
5. Exit
enter your choice(1-6)
0
poukkid Messages postés 106 Date d'inscription mercredi 20 mai 2009 Statut Membre Dernière intervention 11 avril 2012 11
Modifié par poukkid le 29/03/2012 à 15:13
La c'est plus que du déboggage de ton application, teste un peu avec tes valeurs, en 2 minutes j'ai reussi a retomber sur la valeur 4189.5 :

4000-200 = 3800

tes interets : 1.05² = 1.1025

3800*1.1025 = 4189.5

donc dans ton call flow, tu retire 200, puis applique les interets en appelant la methode display() qui appelle calInterest()...



La c'est ton application que tu dois travailler pour qu'elle fasse ce que tu veux, on pourra pas t'aider plus que ca...
0
domxaline Messages postés 188 Date d'inscription lundi 16 mai 2005 Statut Membre Dernière intervention 7 mars 2018 10
29 mars 2012 à 15:14
ok,ok
je viens de trouver mon erreur,je n'ai pas pris compte interet oui
c'est vrai merci beaucoup
0