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 07:00
1. you have a small business that is divided into 3 departments: accounting, sales, and administration. these departments have the following number of devices (computers, printers, etc.): accounting-31, sales-28, and administration-13. using a class c private network, subnet the network so that each department will have their own subnet. you must show/explain how you arrived at your conclusion and also show the following: all available device addresses for each department, the broadcast address for each department, and the network address for each department. also, determine how many "wasted" (not usable) addresses resulted from your subnetting (enumerate them).
Answers: 3
question
Computers and Technology, 23.06.2019 20:50
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
question
Computers and Technology, 24.06.2019 15:00
What questions about an audience should be asked during presentation preparation? check all that apply. what does the audience already know about the topic? how will multimedia tools inspire the audience? is the information interesting and engaging? how will this information affect the presentation? will the audience change the message’s purpose? what is likely to interest the audience?
Answers: 3
question
Computers and Technology, 24.06.2019 18:20
7. design a circuit with three inputs (x, y, and z) representing the bits in a binary number, and three outputs (a, b, and c) also representing bits in a binary number. when the input is 1, 2, or 3, the binary output should be one lesser than the input. when the input is 4, 5, or 6, the binary output should be one greater than the input. when the input is 0, the output is 0, and when the input is 7, the output is 7. show your truth table, all computations for simplification, and the final circuit.
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, 02.12.2021 02:00
question
Engineering, 02.12.2021 02:00
Questions on the website: 13722362