jwrbg

asd

Feb 5th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package ProgammingBasics;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ProjectPrizeExam {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int typesOfProject = Integer.parseInt(scanner.nextLine());
  10.         double moneyForOnePoint = Double.parseDouble(scanner.nextLine());
  11.         int totalPoints = 0;
  12.  
  13.         while (typesOfProject > 0) {
  14.             int points = Integer.parseInt(scanner.nextLine());
  15.             if (typesOfProject % 2 == 0) {
  16.                 points = points * 2;
  17.             }
  18.             totalPoints += points;
  19.             typesOfProject--;
  20.  
  21.         }
  22.         double projectPrize = totalPoints * moneyForOnePoint;
  23.  
  24.         System.out.printf("The project prize was %.2f lv.", projectPrize);
  25.  
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment