leniuch

domy

Feb 25th, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. public class domy {
  2.  
  3.     static int zwieksz(String stare, String nowe) throws FileNotFoundException {
  4.     int bezzmian=0;
  5.    
  6.     File dane = new File(stare);
  7.     PrintWriter nowy = new PrintWriter(nowe);
  8.     Scanner odczyt = new Scanner(dane);
  9.     while(odczyt.hasNextLine()){
  10.     String nazwa = odczyt.nextLine();
  11.     int kond = Integer.parseInt(odczyt.nextLine());
  12.     BigDecimal cena = new BigDecimal(odczyt.nextLine());
  13.    
  14.     if(kond==2) {
  15.         bezzmian+=1;
  16.         cena = cena.multiply(new BigDecimal(1.15));
  17.         }
  18.    
  19.     nowy.println(nazwa+" "+kond+" "+cena);  
  20.     }
  21.     nowy.close();
  22.    
  23.    
  24.    
  25.    
  26.     return bezzmian;}
Add Comment
Please, Sign In to add comment