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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:30
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
question
Computers and Technology, 24.06.2019 16:50
Ideally, the backrest is tilted back slightly, so when you turn the wheel your shoulders are the seat.
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
question
Mathematics, 15.04.2021 18:40
question
Mathematics, 15.04.2021 18:40
question
Chemistry, 15.04.2021 18:40
question
Biology, 15.04.2021 18:40
question
Mathematics, 15.04.2021 18:40
question
Spanish, 15.04.2021 18:40
Questions on the website: 13722367