Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Bills {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int months = Integer.parseInt(sc.nextLine());
- double water = 20;
- double inet = 15;
- double other = 0;
- double totalEl = 0;
- double procent = 0;
- double totaaal = 0;
- for (int i = 1; i <= months; i++) {
- double electro = Double.parseDouble(sc.nextLine());
- totalEl += electro;
- other = electro + water + inet;
- procent = other+(other*0.20);
- totaaal += procent;
- }
- double avarage = totaaal+totalEl+water*months+inet*months;
- System.out.printf("Electricity: %.2f lv%n",totalEl);
- System.out.printf("Water: %.2f lv%n",water*months);
- System.out.printf("Internet: %.2f lv%n",inet*months);
- System.out.printf("Other: %.2f lv%n",totaaal);
- System.out.printf("Average: %.2f lv%n",avarage/months);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment