Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package utility;
- import android.app.Activity;
- /**
- * Created by steve on 11/17/16.
- */
- public class CompletenessScore {
- AccountSharedPreferences ap;
- private int address = 0;
- private int businessUsername = 0;
- private int city = 0;
- private int country = 0;
- private int currency = 0;
- private int phone = 0;
- private int desciption = 0;
- private int website = 0;
- private int logo = 0;
- public CompletenessScore(Activity activity) {
- ap = new AccountSharedPreferences(activity);
- }
- public int CalculateCompletenessScore() {
- if (ap.getAddress().length() > 0) {
- address = 1;
- }
- if (ap.getBusinessUserName().length() > 0) {
- businessUsername = 1;
- }
- if (ap.getCity().length() > 0) {
- city = 1;
- }
- if (ap.getCountry().length() > 0) {
- country = 1;
- }
- if (ap.getCurrency().length() > 0) {
- currency = 1;
- }
- if (ap.getPhone().length() > 0) {
- phone = 1;
- }
- if (ap.getDescription().length() > 0) {
- desciption = 1;
- }
- if (ap.getWebsite().length() > 0) {
- website = 1;
- }
- if (ap.getLogo().length() > 0) {
- logo = 1;
- }
- int sum = address + businessUsername + city + country + currency + phone + desciption + website + logo;
- double finalScore = (sum / (double) 9) * 100;
- // double finalScore = (4/ (double) 8) * 100;
- return (int) finalScore;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement