who is going to help me with a program
ur company grows now. And you are trading with many companies. So, you are recording transactions of n companies in a file. Every company transactions are listed in a line with a positive or negative number:
debits are negative (you payed for your buys) and
credits are positive (you are paid for what you sell).
Because every company have different number of transactions, the transactions end with a 0 (zero). Then, your balance is
Balance = (Your income)- (your expenses)
Question: Write a program that is going to calculate the total balance and the company with which you have the most trade (buys + sells).
You will be given an integer (n) the number of companies where 0 ? n ? 2000. Then, in each of the following n lines you will be given:
Company ID: a string starting with two letters (from 26 uppercase English chars) and consisting of 4 digits
at most 250 floating point (positive or negative) numbers ending with a 0 (zero).
Show two information:
Total balance: floating point number with 2 digits precision
The ID of company with which you have the most trade (buys + sells)
Note: If there are several companies with the same most trade amount, show the company which appears the first.
Sample Input I
NL5755 60 70 -25.5 0
AM1966 -25 -60 0
SB9468 82 -20 34 -53 0
TB1567 60.5 -44 66 0
Sample Output I:
Explanation: Here are the company balances according to given information:
Then, total balance is 145 (104.5 - 85 + 43 + 82.5), and the company with which you have the most trade is SB9468, because total buys and sells is the max (189).
needdddd help pleaseeee
Post a Reply
|Oldest Newest Rating|
Used in many types of software including music players, video games, and many large scale applications.
|Bucky Roberts Administrator|