Guest User

Untitled

a guest
Aug 24th, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.  
  8. public static void main(String[] args) {
  9. Scanner scanner = new Scanner(System.in);
  10.  
  11. int project = Integer.parseInt(scanner.nextLine());
  12. double money_price = Double.parseDouble(scanner.nextLine());
  13.  
  14. double sum = 0;
  15. double total_sum=0;
  16.  
  17. for (int i = 0; i <project; i++) {
  18. int points= Integer.parseInt(scanner.nextLine());
  19. if (i%2==1) {
  20. sum += points * 2;
  21. } else {
  22. sum+=points;
  23.  
  24. }
  25.  
  26. }
  27. total_sum=money_price*sum;
  28. System.out.printf("The project prize was %.2f lv.", total_sum);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment