# Siblings Fund Raising Java Program Solution

#### Question:-

Harry, James, Leo, and Sara are siblings and their mother has asked them to sell cake boxes for a fundraising event. She told them that there is a surprise gift for the ones who sell the maximum number of boxes. There can be more than one maximum.

Write a program to display the names of all the siblings who receive gifts by selling the maximum number of boxes. If all the four sold the same number then display, “All get the same gifts.”

Sample input 1:

Enter the number of boxes sold by Sara

14

Enter the number of boxes sold by Harry

14

Enter the number of boxes sold by Leo

14

Enter the number of boxes sold by James

10

Sample output 1:

Sample input 2:

Enter the number of boxes sold by Sara

14

Enter the number of boxes sold by Harry

14

Enter the number of boxes sold by Leo

14

Enter the number of boxes sold by James

20

Sample output 2:

#### Code:-

```import java.util.*;

public class Main{
public static void main (String[] args) {
Scanner sc= new Scanner(System.in);
System.out.println("Enter the number of boxes sold by Sara");
int Sara = sc.nextInt();
System.out.println("Enter the number of boxes sold by Harry");
int Harry = sc.nextInt();
System.out.println("Enter the number of boxes sold by Leo");
int Leo = sc.nextInt();
System.out.println("Enter the number of boxes sold by James");
int James = sc.nextInt();
if(Sara==Harry && Harry == Leo && Leo==James){
System.exit(0);
}
if(Sara==Harry && Harry==Leo && Leo>James){
System.exit(0);
}
if(Sara== James && Leo == James && James> Harry){
System.exit(0);
}
if(Sara== Harry && Harry== James && James>Leo){
System.exit(0);
}
if(Harry==James && Leo==James && James>Sara){
System.exit(0);
}
if(Sara == Harry && Harry>Leo && Harry>James){
}
else if (Sara == Leo && Leo>Harry && Leo>James ){
}
else if(Sara == James && James>Harry & James>Leo){
}
else if(Harry== Leo && Leo>Sara && Leo>James){
}
else if (Harry==James && James>Sara && James>Leo){
}
else if(Leo == James && Leo>Harry && Leo>Sara){
}
else if(Sara>Harry && Sara>James && Sara>Leo){
}
else if (Harry>Sara && Harry>Leo && Harry>James){