You could just use simple math in Java.
Example:
int peopleAmount = 3;
int money = peopleAmount * 5;
System.out.println(money); //Would print 15
This example would calculate the money I would need if I give 3 people each 5$. You can easily adapt that example.
I know it can be hard to learn a programming language, but you should learn (at least) the basics, like calculating with integers, doubles…
I would recommend SoloLearn. They have free apps for Android, iOS and even Windows Phone. Just download “Learn Java” and learn the basics of Java. Please don’t ask people on StackOverflow for help in terms of Java basics. This is a community for more complex questions.
solved Iteration of an integer