In Java:
Main function must be in a separate class called "IncomeDemo"
Write an "Income" class that stores the total monthly income for each of the 12 months into an array of doubles. The class should have methods that return the following:
Write a program that demonstrates this class. You'll need to pass a 12-element double array to the class constructor.
Important: name your class "Income" and your demo program's class "IncomeDemo".
If you have any doubts, please give me comment...
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 income for the year is: "+income.totalIncome());
System.out.println("Average monthly income is: "+income.averageIncome());
System.out.println("the month with the highest income is: "+income.highestIncome());
System.out.println("the month with the lowest income is: "+income.lowestIncome());
}
}
class Income{
private double income[];
public Income(double income[]){
this.income = income;
}
public double totalIncome(){
double total = 0.0;
for(int i=0; i<12; i++){
total += income[i];
}
return total;
}
public double averageIncome(){
return totalIncome()/12;
}
public int highestIncome(){
int highest = 0;
for(int i=0; i<12; i++){
if(income[highest]<income[i])
highest = i;
}
return (highest+1);
}
public int lowestIncome(){
int lowest = 0;
for(int i=0; i<12; i++){
if(income[lowest]>income[i])
lowest = i;
}
return (lowest+1);
}
}

In Java: Main function must be in a separate class called "IncomeDemo" Write an "Income" class...
In Java 8 Write a HomeworkGrades class that stores the homework grades for 8 chapters into an array of doubles. • Write a constructor that takes an array as input and copies the contents of the array into the class’ array. • Write methods to calculate: • The average of the homework grades • The lowest grade • Write a main function that creates an array with this data: • double[ ] grades = {98.7, 77.9, 90, 83, 67, 33,...
Java Code Help! Code this: Calculate statistics. Write a class called Statistics that can calculate a number of properties about an array of doubles. There should be separate static methods to calculate the min, the max, the mean, the median, the standard deviation (make sure to make use of your mean method to implement this), and the mode. For the mode, you can assume that the data set is not multimodal. This class should not have a main method. Write...
Java Program 1. Write a class that reads in a group of test scores (positive integers from 1 to 100) from the keyboard. The main method of the class calls a few other methods to calculate the average of all the scores as well as the highest and lowest score. The number of scores is undetermined but there will be no more than 50. A negative value is used to end the input loop. import java.util.Scanner; public class GradeStat {...
Q1. Write a C++ class called Time24h that describes a time of the day in hours, minutes, and seconds. It should contain the following methods: • Three overloaded constructors (one of which must include a seconds value). Each constructor should test that the values passed to the constructor are valid; otherwise, it should set the time to be midnight. A display() method to display the time in the format hh:mm:ss. (Note: the time can be displayed as 17:4:34, i.e. leading...
IN JAVA write a class called mySchool that has no main method that provides the following (JUST HARD CODE NO MAIN) min(int a, int b) max(int a, int b) avg(int a, int b) sum(int a,int b) convert(double a, string s) if s is F convert to celcius if s is C convert to faraenheit Then write a seperate java program WITH a main to test all the methods from the class mySchool
Java project
Project Complex number class. Tuesday April 17 Write a Complex number class. It will have a default constructor, explicit constructor, and the following methods: read O public Complex add(Complex), public Complex subtract(Complex), public Complex multiply(Complex), public Complex divide(Complex), public boolean equals(complex) and a toString) method. Include get and set methods as well. On my website is an explanation of complex numbers and examples with expected answers along with a main demo program. Study the explanation and use your...
Implement a Java class that is called RainFall that uses a double array to store the amount of rainfall for each month of the year. The class should have only one instance variable of type double[]. Implement the following methods in the RainFall class: 1. A constructor that creates and initializes all entries in the array to be -1. 2. toString: a method that returns a one-line String representation of the object that includes 12 double numbers that represent the...
In Java language: Write a rainfall class that stores the total rainfall for each of 12 months of years 2015 -2017 into an 2D array of doubles. Use the text file at Actividades/Tareas link as input of rainfall data. The program should read the input data from a text file. The program should have methods that at least return the following: • Total rainfall for the years 2015 – 2017 - return a 1D array • The average monthly rainfall...
Question set 1 (Java) object oriented: 1.Write a class called Student. The class should be able to store information regarding the name, age, gpa, and phone number of a Student object. Please write all the setter and getter methods. Finally, write a Demo class to demonstrate the use of the class by creating two different objects. 2.Use the same Student class from the previous problem. This time,you will write a different Demo class, in which you will create three Student...
The Language is Java GenericMethodTest (20) Download the OverloadedMethods.java program. Replace all the methods except main with a single generic method that produces the same output. Call the new file GenericMethodsTest.java. OverloadMethods.java: // Printing array elements using overloaded methods. public class OverloadedMethods { // method printArray to print Integer array public static void printArray(Integer[] inputArray) { // display array elements for (Integer element : inputArray) { System.out.printf("%s ", element); } System.out.printf("\n"); } // method printArray to print Double array public...