Kotlinlearncs.online LogoJava
Return to List

Solve: Accounting Calculator

Created By: Miguel Fernandez
/ Version: 2021.7.0

The Accounting firm LambdaCalculator is running out of money. In the past few months, they've struggled to find new clients, and as a result they are looking at laying off staff. They've hired you to build some software that fulfills the role of their accountants. As the first step, you will write some code that calculates the gross profit (total revenue minus total expenses) for monthly financial reports.

Write a function called calculateGrossProfit that takes in two IntArray parameters, the revenue for each day of a month then the expenses for each day of a month, and returns the gross profit (revenues minus expenses) as an Int. You may assume that both passed arrays will be the same length.

Here's an example of how your class should behave:

Readings:

Related Lessons

Stuck? You may find these lessons helpful: