Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:20, dylanolmeda9
The thickness of a part is to have an upper specification of 0.925 and a lower specification of 0.870 mm. the average of the process is currently 0.917 with a standard deviation of 0.005. determine the percentage of product above 0.93 mm.
Answers: 3
image
Computers and Technology, 21.06.2019 17:30, jacksonthelma82
Data for which there is temporarily no room in ram is diverted to where on your computer? question 9 options: a) the paging file on the hard drive b) the system file on the hard drive c) the memory file on the hard drive d) the cpu cache
Answers: 2
image
Computers and Technology, 22.06.2019 19:00, detrickboucicaut
The fourth generation of computers emerged between 1970s and 1980s. which technological advancement brought about this generation of computers? which computer architecture was used most in this generation?
Answers: 3
image
Computers and Technology, 23.06.2019 01:30, winstonbendariovvygn
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
Do you know the correct answer?
Write a program that calculates the invoice of each flat in the apartment building. There are N fla...

Questions in other subjects:

Konu
Mathematics, 08.02.2021 08:20
Konu
Mathematics, 08.02.2021 08:20