Java Main Function Must Separate Class Called Incomedemo Write Income Class Stores Total M Q37096940

In Java:

Main function must be in a separate class called”IncomeDemo”

Write an “Income” class that stores the total monthly income foreach of the 12 months into an array of doubles. The class shouldhave methods that return the following:

  • total income for the year
  • average monthly income
  • the month with the highest income
  • the month with the lowest income

Write a program that demonstrates this class. You’ll need topass a 12-element double array to the class constructor.

Important: name your class “Income” and yourdemo program’s class “IncomeDemo”.


Solution


If you have any doubts, please give mecomment…

public class IncomeDemo{

public static void main(String[] args){

double empIncome[] ={754,273,288,288,773,284,884,883,887,242,487,244};

Income income = new Income(empIncome);

System.out.println(“Total

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.