Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int amountBiscuits = Integer.parseInt(scanner.nextLine());
- int countWorkers = Integer.parseInt(scanner.nextLine());
- int biscuits30Days = Integer.parseInt(scanner.nextLine());
- double percents = 0.0;
- double productionOfMonth = 0.0;
- for (int i = 1; i <= 30; i++) {
- if (i % 3 == 0) {
- productionOfMonth += Math.floor(0.75 * amountBiscuits * countWorkers);
- } else {
- productionOfMonth += amountBiscuits * countWorkers;
- }
- }
- System.out.println(String.format("You have produced %.0f biscuits for the past month.", productionOfMonth));
- if (productionOfMonth >= biscuits30Days) {
- percents = ((productionOfMonth - biscuits30Days) / biscuits30Days) * 100;
- System.out.println(String.format("You produce %.2f percent more biscuits.", percents));
- } else {
- percents = ((biscuits30Days - productionOfMonth) / biscuits30Days) * 100;
- System.out.println(String.format("You produce %.2f percent less biscuits.", percents));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement