Advertisement
cesarnascimento

numeros random mercadorias q1 andreza

Aug 16th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. package andreza;
  2.  
  3. import java.util.Random;
  4.  
  5. public class q1 {
  6.  
  7.     public static void main(String[] args) {
  8.        
  9.         int faturamento = 0;
  10.         Random vend = new Random();
  11.         Random prec = new Random();
  12.        
  13.         for(int i = 1; i <= 100; i++) {
  14.             faturamento += (int) ((prec.nextDouble() * vend.nextInt(50)+1));
  15.             //System.out.println("O valor do "+i+"º faturamento é: " +(prec.nextDouble() * vend.nextInt(50)+1));
  16.         }
  17.        
  18.             System.out.println("O valor de faturamento total é: "+faturamento);
  19.        
  20.        
  21.        
  22.  
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement