It is a Fun Love calculator algorithm to find out love percentage. It is only for fun.
You can check FLAMES Game.
You can check FLAMES Game.
Here is Java program.
package swain.swain;
import java.util.ArrayList;
import java.util.List;
public class LoveCalculator {
private static List<String> getCount(String fname, String sname) {
List<String> list = new ArrayList<String>();
String love = "Love";
String name1 = fname;
String name2 = sname;
for (int i = 0; i < name1.length(); i++) {
String temp = name1.charAt(i) + "";
if (list.contains(temp)) {
int indexOfElement = list.indexOf(temp);
int prevCount = Integer.parseInt(list.get(++indexOfElement).toString());
prevCount++;
String newCount = (prevCount) + "";
list.set(indexOfElement, newCount);
continue;
}
list.add(temp);
list.add("1");
}
for (int i = 0; i < name2.length(); i++) {
String temp = name2.charAt(i) + "";
if (list.contains(temp)) {
int indexOfElement = list.indexOf(temp);
int prevCount = Integer.parseInt(list.get(++indexOfElement).toString());
prevCount++;
String newCount = (prevCount) + "";
list.set(indexOfElement, newCount);
continue;
}
list.add(temp);
list.add("1");
}
for (int i = 0; i < love.length(); i++) {
String temp = love.charAt(i) + "";
if (list.contains(temp)) {
int indexOfElement = list.indexOf(temp);
int prevCount = Integer.parseInt(list.get(++indexOfElement).toString());
prevCount++;
String newCount = (prevCount) + "";
list.set(indexOfElement, newCount);
continue;
}
list.add(temp);
list.add("1");
}
List<String> result = new ArrayList<String>();
for (int i = 1; i < list.size(); i += 2) {
result.add(list.get(i));
}
return result;
}
private static int getLovePercentage(String fname, String sname) {
List<String> count = getCount(fname, sname);
if (count.size() == 1) {
String result = count.get(0).toString() + "";
return Integer.parseInt(result);
}
if (count.size() == 2) {
String result = count.get(0).toString() + count.get(1).toString();
return Integer.parseInt(result);
}
do {
List<String> sub = new ArrayList<String>();
int size = count.size() / 2;
for (int i = 0; i < size; i++) {
String newC = (Integer.parseInt(count.get(i).toString()) + Integer.parseInt(count.get(count.size() - 1 - i).toString())) + "";
if (newC.length() == 2) {
sub.add((newC.charAt(0) + ""));
sub.add((newC.charAt(1) + ""));
} else {
sub.add(newC);
}
}
if ((size * 2) != count.size())
sub.add(count.get(size));
count = new ArrayList<String>();
count = sub;
} while (count.size() != 2);
String result = count.get(0).toString() + count.get(1).toString();
return Integer.parseInt(result);
}
public static String getLovePercentageResult(String fname, String sname) {
int per = getLovePercentage(fname, sname);
String result = "Love Percentage Between " + fname + " And " + sname + " is " + per + "% ";
return result;
}
public static void main(String args[]) {
System.out.println(LoveCalculator.getLovePercentageResult("Rama", "Sita"));
}
}
Output:
I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon… online antiderivative calculator
ReplyDeleteYour post is providing good information. I liked it and enjoyed reading it. Keep sharing such important posts. I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article. I enjoyed every little bit part of it and I will be waiting for the new updates. I really appreciated this post. Just want to say thank you for the information you have shared. Just continue writing this kind of post.
ReplyDeletehow to get rid of hiccups
I have been using this app Amazon Shopping Apk : and downloaded and gambling it frequently.
ReplyDeleteThis type of message always inspiring and I prefer to read quality content, so happy to find good place to many here in the post, the writing is just great, thanks for the post.
ReplyDeletein love quiz
What a fantabulous post this has been. Never seen this kind of useful post. buy YouTube Views cheap
ReplyDeleteI recently found much helpful information on your website, especially this blog page. best place to buy Instagram followers
ReplyDelete