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