subject

Write a program that calculates the invoice of each flat in the apartment building. There are N flats in a building and apartment heating is the central system. 30% of bill will be shared
equally among the flats, the rest (70%) will be shared according to the consumption of each
flat.
Sample Calculation:
 Suppose that an apartment building has 3 flats
 Consumption of each flat (m3
): 12.8, 23, 9.2
 Total Bill: 320.40 TL
o 30% of bill: 96.12 TL
o 70% of bill: 224.28 TL
 Then, the bill for each flat should be calculated as follows:
o The bill for the Flat #1: 32.04 + 63.80 = 95.83 TL
o The bill for the Flat #2: 32.04 + 114.63 = 146.67 TL
o The bill for the Flat #3: 32.04 + 45.85 = 77.89 TL
Your program must have the following methods:
public static void main(String[] args)
 Main method will take the inputs from the user.
 Then, it will invoke calculateTheInvoice () and printBills() methods,
respectively.
public static double[] calculateTheInvoice (double[] flats,
double totalBill)
 You should calculate the bill of each flat based on the given sample calculation scenario.
 This method should take the following parameters:
o A double array flats that indicates the consumption of each flat.
o A double value totalBill that contains the total consumption of the whole
apartment building. Then, the method should return a double array, which contains the calculated bill for
each flat, to the main() method.
public static void printBills (double[] bills)
 You should print the values to the console display.
First input (N) is the number of flats in the apartment building. It is followed by N inputs for N flat
consumption, and the last input is for the total bill.
Input Format: N C1 C2 C3 .. Cn TotalBill
Sample Input: 3 12.8 23 9.2 320.40
Here,
 N: the number of flats
 C1, C2, .. Cn: Consumption of each flat
 TotalBill: The total Bill for the apartment building

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:40, pbarbee3034
Nims is applicable to all stakeholders with incident related responsibilities. true or false
Answers: 1
image
Computers and Technology, 23.06.2019 06:40, euniceyi56
How many nibbles can be stored in a 16-bit word?
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, toolazytobehuman
Me and category do i put them in because this is science
Answers: 1
image
Computers and Technology, 24.06.2019 10:00, wwwcarolynzouowficz
3. what do the terms multipotentialite, polymath, or scanner mean?
Answers: 2
You know the right answer?
Write a program that calculates the invoice of each flat in the apartment building. There are N fla...

Questions in other subjects:

Konu
English, 05.11.2020 07:40
Konu
Biology, 05.11.2020 07:40
Konu
Social Studies, 05.11.2020 07:40