0
import java.io.*;
class Edogs
{
  public static void main (String args [])
    throws java.io.IOException 
  {
    final int subtractor = 1;
    final int MAX_QUESTIONS = 48;
    final int MAX_INPUT = 47;
    final int MAX_ANSWERS = 4656;
    final int MAX_COUNTER = 4654;
    int pomeranian = 0; 
    FileReader fro = new FileReader ("edogs_questions.txt");
    BufferedReader bfrr = new BufferedReader (fro);
    
    
    String questionArray [] = new String [MAX_QUESTIONS];
    // this reads all the questions and answers from edogs_questions.txt
    for (int countArray = 0; countArray <= MAX_INPUT; countArray ++)
    {
      
      questionArray [countArray] =  bfrr.readLine();
      
    }
    
    fro.close(); 
    
    String inputquestionArray [] = new String [MAX_QUESTIONS];
    BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
    
    // this ouputs the questions (taken from edogs_questions.txt
    // and stores users answers in an array
    for (int counter = 0; counter <= 46; counter ++)
    {
      System.out.println (questionArray[counter]);
      inputquestionArray [counter] = br.readLine();
    }
    
    
    FileReader frda = new FileReader ("dogAttributes.txt");
    BufferedReader bfrda = new BufferedReader (frda);
    
    String attributeArray [] = new String [MAX_ANSWERS];
    // this reads all the attributes of the dogs
    for (int countArray = 0; countArray <= MAX_COUNTER; countArray ++)
    {
      
      attributeArray [countArray] = bfrda.readLine();
      
    }
    frda.close();
    
    // this compares users answers and the attributes
    for (int compare_counter = 1; compare_counter <= 47; compare_counter++)
    {
      if (inputquestionArray [compare_counter - subtractor].equalsIgnoreCase (attributeArray [compare_counter]))
      {
        
        pomeranian ++;
        System.out.print(pomeranian);
      }
    }
  }
}

What size dog would you like to have? (tiny, very small, small, medium, large, very large, over sized)
How many times would to like to walk your dog? (none, some, every other day, daily, twice daily)
How long would you like to walk your dog? (5 minutes, 10 minutes, 15 minutes, 30 minutes, 60 minutes)
Would you like the dog to be child friendly? (yes, no)
How much hair would you like the dog to shed? (none, little, average, heavy)
What colour would you like the dog to be? (black, white, brown, yellow, tan, varied)
What type of ear would you like the dog to have? (floppy, pointed, flat)
How long would you like the dog’s tail to be? (long, medium, short, stubby)
What type of tail texture would you like the dog to have? (curly, puffy, whiptails, feathery)
How long would you like the dog’s fur to be? (none, short, medium, medium long, long, shaggy)
What eye colour would you like the dog to have? (blue, brown, hazel, varied, black, amber)
What muzzle size would you like the dog to have? (flat, medium, long)
What type of bark would you like the dog to have? (yip, high, booming, scary, none, yodel)
What activity level would you like the dog to have? (Low, Medium, High)
What size feet would you like the dog to have? (Extra Small, Small, Medium, Large, Extra Large)
How hard should it take to train your dog? (Easy, Moderate, Hard, Extra Difficult)
What health issues should the dog have no problems with? (Sight, Hearing, Heart, Cancer, Hip, Back, Bone, Multiple)
How intelligent would you like the dog to be? (Low, Medium, High)
How much grooming should the dog require? (0, 1-7, 8-14, 15-21)
How high would you like the work ethic for your dog to be? (none, low, medium, high)
How hard should it be to house train your dog? (Easy, Moderate, Hard, Extra Difficult)
What type of breed would you like the dog to be? (Herding, Guard, House, Work, Pastoral, Play, Lap, Show, Hunting)
How long would you like the dog to live? (5-7, 8-10, 11-13, 14+)
Would you like the dog to have separation anxiety? (yes, no)
What climate will the dog be living in? (Cold, Moderate, Warm, Hot, Any)
Would you like the dog to be a sight hound? (Yes, No)
Would you like the dog to be pure bred? (Yes, No)
At what age would you like to buy your dog? (Puppy, Adolescent, Adult, Any)
Should your dog be hair or hairless? (Fur, Hair, Hairless)
To what people should your dog be attached too? (Person, Family, None, All)
What should the maintenance level of your dog be? (Low, Medium, High)
Should your dog be fearless? (Yes, No)
Should your dog be playful? (yes, No)
Should your dog be sociable? (yes, sometimes, No)
Should your dog be independent? (Yes, No)
Should your dog be courageous? (Yes, No)
Should your dog be easy to handle? (Yes, No)
What height do you want your dog to be? (1-15, 16-24, 25-30, 31-40, 41-50, 51-60, 61-80, 81-100, 101+)
What should the litter size would your dog require? (1-2, 3-5, 6-7, 8+)
What level of drool does your dog have? (Low, Medium, High)
Should your dog be able to swim? (Yes, No)
What location should your dog be able to live in? (City, Country, anywhere)
What type of pets should your dog be OK with? (smaller, bigger, none, any)
What should the maintenance level of your dog be? (0-500,501-1500, 1501+)
What should the purchase cost of your dog be? (0-200, 201-600, 601-1200, 1201-2000, 2001+)
What coat pattern would your dog have? (solid, wire, thick, short, hard, corded, curly, thick, fluffy)
Do you require the dog to be non allergenic? (Yes, No)


I researched a lot of dogs and their attributes as seen above then i will ask them a series of 47 questions then compare their answers to my researched answers. Every time they get a answer 'right' or the answers match the dog will be given 1 point the one with the highest points will be the most compatible. I am kinda stuck at comparing the two arrays - the answers obtained from the user and the researched answers
Any input will be awesome
Please and Thank you :)

Edited by peter_budo: Please do not use [tex] tag when posting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by stultuske
0

1. put your code within code tags, makes it easier to read for us ..

int[] answers = {1,2};
int[] inputByUsers = new int[2];

// code to retrieve input

int points = 0;

for ( int i = 0; i < answers.length ; i++){
      if ( answers[i] == inputByUsers[i] )
           points += 1;
}

System.out.println("You scored " + points + " points");

if it's about small arrays (and 47 isn't that very big), this way of comparing should be sufficiënt

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.