Jump to content

Recommended Posts

Posted
import java.text.DecimalFormat;
public class TrabalhoPratico
{ public static void main (String [] args)

{menu(); }



 public static void menu()

 { byte op;



   do

   { do

     { System.out.println("\nM E N U");

       System.out.println("1 - Mercado Formal");
       System.out.println("2 - Mercado Informal");
       System.out.println("3 - Mercado Semi-Informal");
       System.out.println("4 - Sair");
       System.out.print("Qual é a tua opção? ");

       op = Le.umByte ();

       System.out.println ("\tEscolheu opcao "+ op+"\n");

     } while (op < 1 || op > 4);

     switch (op)

     { case 1: submenuFormal(); break;

       case 2: submenuInFormal();   break;

       case 3: submenuSemiInformal(); break;
     }

   } while (op != 4);

 }

 public static void submenuFormal()

 { byte op;

   int numLojas=0;

   do

   { do

     { System.out.println("\nF O R M A L");

       System.out.println("1 - Introduza Quantidade de Lojas");
       System.out.println("2 - Introduza o Valor da Renda");
       System.out.println("3 - Visualizar Tabela");
       System.out.println("4 - Sair");
       System.out.print("Qual é a tua opção? ");

       op = Le.umByte ();

       System.out.println ("\tEscolheu a Opção: "+op+"\n");

     } while (op < 1 || op > 4);

     switch (op)

     { case 1:numLojas=qntLojas() ; break;

       case 2:qntF(numLojas) ;  break;

       case 3:; break;
     }
public static int qntLojas() //Metodo da Quantidade de Lojas
  {int lojas;
   do
   {System.out.println("Introduza a Quantidade de Lojas");
   lojas=Le.umInt();
    if(lojas<=0)
    System.out.println("Quantidade Invalida!Tente Novemente!");
   }while(lojas<=0);
  return lojas;
  }



  public static float renda() //Metodo do Valor da Renda
  { float renda;
    DecimalFormat mt=new DecimalFormat("###,###.00 Mt");
    do
    {System.out.println("Introduza o Valor da Renda de Aluger da Loja:");
    renda = Le.umFloat();
     if (renda<=0)
    System.out.println("Valor Invalido!Tente Novamente!");
    }while(renda<=0);
    System.out.println("Valor do Mercado Formal:"+mt.format(renda));
    return renda;
  }


  public static float calFormal(float renda,int quant)
  {float calformal;


   calformal=quant*(renda+20);

   {System.out.println("O Valor do Mercado Formal é:"+calformal);
    return calformal;
   }

  }

  public static float valReceb(int quant,float renda)
  {float valreceb;

   valreceb=quant*(renda);
   return valreceb;
   }

 public static void qntF(int quant,float calformal,float valreceb)
  {float renda;

   for(int i=1; i<=quant; i++)
   {renda=renda();
   }
   visualizar(quant,calformal,valreceb);
  }

 public static void metodoAlinhar(float numer)
  {
   for (int g=5;g<=1000000;g*=5) //5,25,125,625,3125,15625,78125,390625,19523125
     if(numer<g)
       System.out.print(" ");
     System.out.print(" "+numer);
     System.out.print(" |");
  }


   public static void visualizar(int a,float b,float c)
   {
     System.out.println("\n");
     System.out.println(" =================================================");
     System.out.println("     --------=========FORMAL=========-------   ");
     System.out.println(" =================================================");
     System.out.println(" | Quantidade |  Valor Recebido  |  Valor Ganho  |  ");
     System.out.println(" =================================================");
     System.out.print(" |");
     metodoAlinhar(a);
     metodoAlinhar(b);
     metodoAlinhar(c);
     System.out.println();
     System.out.println(" =================================================");
     System.out.println("\n");
   }
}

Alguem pode ajudar-me eh q ta a dar um erro a dizer: qntF(int,float,float) int TrabalhoPratico cannot be applied to (int)

nao liguem para a class Le.um.. eh uma classe feita pela minha faculdade e mandaram-nos usa-la...

a ideia eh o os valores aparecerem na tabela e taria queria uma ajuda no alinhamento da tabela...

Posted

A função é definida assim:

public static void qntF(int quant,float calformal,float valreceb)

E estás a chamá-la assim:

qntF(numLojas)

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.