You are a member of the Finance Committee in your Church named God\'s People Chu
ID: 3855829 • Letter: Y
Question
You are a member of the Finance Committee in your Church named God's People Church. Your Pastor has approached you to develop an application that will record the contributions made up of tithes and offerings paid in Cash and Checks by each member of the church. At the end of each financial year, the Pastor wants to see the total contribution of each member to be able to send a letter of appreciation to each of them, stating sum total of individual contribution for the year, and thanking them. Using Java program, create a runnable JAR file using Eclipse that displays the following: (a) Name of the Church (b) Name of the members of the church (c) Total Contribution of each of the members in front of their names. Assuming there are 5 people that worship in the Church. Now create a runnable JAR file and test that it runs outside the IDE!Explanation / Answer
import java.util.*;
public class HelloWorld{
public static void main(String []args){
int sum[] = new int[5];
String name[] = {"John","Mathews","Chris","Bruce" , "Joe"};
int sumindividual =0;
int value = 0;
Scanner sc = new Scanner(System.in);
for(int i=0;i<5;i++){
for(int j=0;j<12;j++){
sumindividual = 0;
System.out.println();
System.out.print("Enter details for "+ name[i] +" for the "+ (j+1)+ " month: ");
value = sc.nextInt();
sumindividual = sumindividual + value;
}
sum[i] = sumindividual;
}
System.out.println("Church Name");
for(int i=0;i<5;i++){
System.out.println(name[i]);
}
System.out.println(" ");
for(int i=0;i<5;i++){
System.out.println(name[i]+" "+sum[i]);
}
System.out.println(" ");
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.