Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Vendas{
- public static void main(String []args){
- Vendas resultado = new Vendas();
- double[] vendas = {1000.00, 1500.00, 2000.00, 1800.00};
- double soma = resultado.calculaSoma(vendas);
- resultado.exibe(vendas, soma);
- }
- public double calculaSoma(double[] valor){
- double soma = 0.0;
- for(int i=0; i<valor.length; i++){
- soma += valor[i];
- }
- return soma;
- }
- public static void exibe(double[] vendasIn, double somaIn){
- System.out.println("-------------------");
- System.out.println(" TRIMESTRE DE VENDAS ");
- System.out.println("-------------------");
- for(int j=1; j<=vendasIn.length; j++){
- System.out.println("------" + j + "-------");
- }
- System.out.println("-------------------");
- System.out.println("----- Total: " + somaIn);
- System.out.println("-------------------");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement