Annual Revenue The given code declares an array that holds the monthly revenues for a company for a year. You need to calculate | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Annual Revenue The given code declares an array that holds the monthly revenues for a company for a year. You need to calculate

Java

26th Aug 2023, 8:58 PM
D M D E V I Dissanayake-S22010030-622512534
D M D E V I Dissanayake-S22010030-622512534 - avatar
3 Answers
+ 2
class program{ public static void main(String[] args){ double[] revenue={10000,12000,13500,9000,5600,6700,23000,7850,8900,10050,12050,13550}; double sum=0; for(int i=0;i<revenue.length;i++){ sum=sum+revenue[i]; } double result =sum/revenue.length; System.out.println(result);     } } this code is not being accepted by the compiler
30th Aug 2023, 3:17 AM
Andrew Coutinho
Andrew Coutinho - avatar
+ 1
D M D E V I Dissanayake-S22010030-622512534 If you're having trouble in code, share your code and describe what error message you're receiving.
27th Aug 2023, 1:30 AM
Darpan kesharwani🇮🇳[Inactive📚]
Darpan kesharwani🇮🇳[Inactive📚] - avatar
+ 1
Please help to fix the code so it will run
30th Aug 2023, 3:18 AM
Andrew Coutinho
Andrew Coutinho - avatar