CS201 KNN GameRecommender

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 30

0Technological Institute of the Philippines

Quezon City
College of Information Technology Education

CS201 – Data Structures and Algorithms


GAME RECOMMENDER SYSTEM USING K-
NEAREST NEIGHBOR ALGORITHM
Project Documentation

Lagao, Ronald Jay


Abejuro, August Eldred
Adona, Lance Gabriel

1st Semester 2019-2020


Table of Contents Page No.
I. Project Rationale……………………………
II. Table of Course Content Application
III. Screenshots …………………………………..
IV. Source Code………………………………….
V. Members Information …………………..
Project Rationale

This project was developed for the reason that


most recommender system for games are limited to
having a game title input or a genre input. Therefore
the project, game recommender system, as the name
implies, recommends games to the user base on the
users input.
What can be usually seen in a recommender
system is the recommendation of games based on a
specific game title as a basis or having a genre as an
input, meanwhile this project uses the two genres as
the user’s input, asks the user for how much they
would rate that specific genre and ask for the preferred
device for the games that would be recommended by
the system. The project can be used by users to find
different combinations of genre that is inside a game,
the project can be described as something that helps a
user explore games of different styles. This was done
for the purpose of having a not so limited option when
it comes to finding a good game.
K Nearest Neighbour
In pattern recognition, the k-nearest neighbors
algorithm (k-NN) is a non-parametric method used
for classification and regression. In both cases, the
input consists of the k closest training examples in
the feature space. The output depends on whether k-
NN is used for classification or regression: k-NN is a
type of instance-based learning, or lazy learning, where
the function is only approximated locally and all
computation is deferred until classification.
Both for classification and regression, a useful
technique can be to assign weights to the contributions
of the neighbors, so that the nearer neighbors
contribute more to the average than the more distant
ones. For example, a common weighting scheme
consists in giving each neighbor a weight of 1/d,
where d is the distance to the neighbor.

Minkowski Method

In mathematical physics, Minkowski space


(or Minkowski spacetime) is a combination of
three-dimensional Euclidean space and time into a
four-dimensional manifold where the spacetime
interval between any two events is independent of
the inertial frame of reference in which they are
recorded.
Flow Diagram
Table of Course Content Application
Screenshots

The interface of the project, the user must input


necessary information on the fields.
Here is an example of a user’s input.
After clicking the generate button, this is what the
output looks like.
Source Code
package FinalProj;

import java.io.File;

import java.io.IOException;

import java.util.ArrayList;

import java.util.Arrays;

import java.util.HashSet;

import java.util.Iterator;

import java.util.LinkedList;

import java.util.Queue;

import java.util.Scanner;

import java.util.Set;

import java.util.Stack;

import jxl.Cell;

import jxl.Sheet;

import jxl.Workbook;

import jxl.read.biff.BiffException;

public class LastGame {

private String inputFile;

public static void main(String[] args) throws IOException {

LastGame test= new LastGame();

ArrayList<Double> scoreArr = new ArrayList<>();

Queue<String> ansArr = new LinkedList<>();

Scanner scan = new Scanner(System.in);

for(int i=0;i<2;i++) {

System.out.println("Enter Genre: ");

String ans = scan.next();

ansArr.add(ans);

System.out.println("Enter Rating for the Genre: ");

Double ansS = scan.nextDouble();

scoreArr.add(ansS);

System.out.println("Enter Preferred GameSystem: ");

String console = scan.next();

test.setInputFile("D:\\Downloads\\CS201Project\\hatdog.xls");

try {

test.read(ansArr, scoreArr,console);

} catch (BiffException e) {
// TODO Auto-generated catch block

e.printStackTrace();

public void setInputFile(String inputFile) {

this.inputFile = inputFile;

public ArrayList read(Queue<String> ansArr,ArrayList<Double> scoreArr,String console) throws IOException, BiffException

ArrayList<String> all = new ArrayList<>();

LinkedList<Integer> raded = new LinkedList<>();

BinaryTree binn = new BinaryTree();

Minkowski minkow = new Minkowski();

Scanner scan = new Scanner(System.in);

ArrayList<Double> scoreArr2 = new ArrayList<>();

ArrayList<String> ansArr2 = new ArrayList<>();

ansArr2.addAll(ansArr);

scoreArr2.addAll(scoreArr);

String console2 = console;

ArrayList<String> title = new ArrayList<>();

ArrayList<Double> rates = new ArrayList<>();

Radix rad = new Radix();

BubbleSort bub = new BubbleSort();

double rate1[] = new double[2];

double rate2[] = new double[2];

double p = 2.0;

int ctr = 0;

ArrayList<Double> test = new ArrayList<>();

File inputWorkbook = new File(inputFile);

Workbook w = null;

try {

w = Workbook.getWorkbook(inputWorkbook);

// Get the first sheet

Sheet sheet = w.getSheet(0);

double[] tempTen = new double[sheet.getRows()];

int a = 0;
int b = 2;

//loop over first 10 column and lines

for(int j= 3;j<sheet.getColumns();j++){

for (int i=0;i<sheet.getRows(); i++) {

Cell cell = sheet.getCell(j,i);

Cell plat = sheet.getCell(1,i);

if((cell.getContents().contains(((LinkedList<String>) ansArr).get(0)) ||
cell.getContents().contains(((LinkedList<String>) ansArr).get(1)))&& plat.getContents().contains(console))

Cell game =sheet.getCell(a,i);

Cell scr = sheet.getCell(b,i);

rates.add(Double.parseDouble(scr.getContents()));

if(cell.getContents().contains(((LinkedList<String>) ansArr).get(0)) &&


cell.getContents().contains(((LinkedList<String>) ansArr).get(1))) {

rate1[0] = scoreArr.get(0);

rate1[1] = scoreArr.get(1);

rate2[0]= Double.parseDouble(scr.getContents())/2;

rate2[1]= Double.parseDouble(scr.getContents())/2;

title.add(game.getContents());

tempTen[ctr] = minkow.distance(rate1,rate2,p);

ctr++;

else if(cell.getContents().contains(((LinkedList<String>) ansArr).get(0))


|| cell.getContents().contains(((LinkedList<String>) ansArr).get(1))){

for(int h = 1; h<ansArr.size();h++)

rate1[0] = scoreArr.get(0);

rate1[1] = scoreArr.get(1);

rate2[h-1]=
Double.parseDouble(scr.getContents());

rate2[h]= 0;

title.add(game.getContents());

double temp;

temp = minkow.distance(rate1,rate2,p);

tempTen[ctr] = temp;

}
ctr++;

}}}}

Double[] topTen = new Double[ctr];

int control = 0;

for(int x = 0;x<tempTen.length;x++) {

if(tempTen[x] !=0.0) {

topTen[control] = tempTen[x];

control++;

int[] forRadix = new int[topTen.length];

for(int s = 0; s<topTen.length;s++) {

forRadix[s] = (int)Math.round(topTen[s]);

Set<Integer> testing = new HashSet<Integer>();

for(int z = 0;z<forRadix.length;z++)

testing.add(forRadix[z]);

int eas = testing.size();

int [] zzz = new int[eas];

int iii = 0;

for (int x : testing)

zzz[iii++] = x;

int siz = zzz.length;

Radix.radixsort(zzz, siz);

Radix.print(zzz,siz);

for(int i = 0; i<zzz.length;i++)

System.out.println();

System.out.println(zzz[i]);

raded.add(zzz[i]);

}catch(BiffException e) {

e.printStackTrace();

catch(ArrayIndexOutOfBoundsException e)

{
System.out.println("ArrayIndexOutOfBounds Exception occured");

all.add("Sorry Game does Not Exist");

return all;

System.out.println(raded);

ArrayList<Integer> dab = new ArrayList<>();

for(int w1= 0 ; w1<raded.size() ; w1++) {

dab.add(raded.get(w1));

binn.print(dab);

Stack<String> topGames = new Stack<>();

String asd;

for(int end = 0 ;end <raded.size();end++) {

asd = getGame(raded.get(end), ansArr2, scoreArr2, console2);

topGames.push(asd);

int z = 1;

for(int x =topGames.size();x>0;x--)

all.add("Top " + z +" game : "+topGames.pop());

z++;

System.out.println(all);

return all;

public String getGame(int x,ArrayList<String> ansArr,ArrayList<Double> scoreArr,String console) throws IOException {

String gameName = null;

File inputWorkbook = new File(inputFile);

Minkowski minkow = new Minkowski();

ArrayList<Double> rates = new ArrayList<>();

double rate1[] = new double[2];


double rate2[] = new double[2];

double p = 2.0;

Workbook w;

try {

w = Workbook.getWorkbook(inputWorkbook);

Sheet sheet = w.getSheet(0);

int a = 0;

int b = 2;

for(int j= 3;j<sheet.getColumns();j++){

for (int i=0;i<sheet.getRows(); i++) {

Cell cell = sheet.getCell(j,i);

Cell plat = sheet.getCell(1,i);

if((cell.getContents().contains(ansArr.get(0)) ||
cell.getContents().contains(ansArr.get(1)))&& plat.getContents().contains(console))

Cell game =sheet.getCell(a,i);

Cell scr = sheet.getCell(b,i);

rates.add(Double.parseDouble(scr.getContents()));

if(cell.getContents().contains(ansArr.get(0)) &&
cell.getContents().contains(ansArr.get(1))) {

rate1[0] = scoreArr.get(0);

rate1[1] = scoreArr.get(1);

rate2[0]= Double.parseDouble(scr.getContents())/2;

rate2[1]= Double.parseDouble(scr.getContents())/2;

int bx = (int)Math.round(minkow.distance(rate1,rate2,p));

if(x == bx)

gameName = game.getContents();

else if(cell.getContents().contains(ansArr.get(0)) ||
cell.getContents().contains(ansArr.get(1))){

for(int h = 1; h<ansArr.size();h++)

rate1[0] = scoreArr.get(0);

rate1[1] = scoreArr.get(1);
rate2[h-1]=
Double.parseDouble(scr.getContents());

rate2[h]= 0;

int bx =
(int)Math.round(minkow.distance(rate1,rate2,p));

if(x == bx)

gameName = game.getContents();

}catch(BiffException e) {

e.printStackTrace();

return gameName;

class Node

double key;

Node left, right;

public Node(double item)

key = item;

left = right = null;

class BinaryTree

// Root of Binary Tree


Node root;

BinaryTree()

root = null;

/* Given a binary tree, print its nodes according to the

"bottom-up" postorder traversal. */

void printPostorder(Node node)

if (node == null)

return;

// first recur on left subtree

printPostorder(node.left);

// then recur on right subtree

printPostorder(node.right);

// now deal with the node

System.out.print(node.key + " ");

/* Given a binary tree, print its nodes in inorder*/

void printInorder(Node node)

if (node == null)

return;

/* first recur on left child */

printInorder(node.left);

/* then print the data of node */

System.out.print(node.key + " ");

/* now recur on right child */

printInorder(node.right);

}
/* Given a binary tree, print its nodes in preorder*/

void printPreorder(Node node)

if (node == null)

return;

/* first print data of node */

System.out.print(node.key + " ");

/* then recur on left sutree */

printPreorder(node.left);

/* now recur on right subtree */

printPreorder(node.right);

// Wrappers over above recursive functions

void printPostorder() { printPostorder(root); }

void printInorder() { printInorder(root); }

void printPreorder() { printPreorder(root); }

public void print(ArrayList<Integer> dab)

BinaryTree tree = new BinaryTree();

tree.root = new Node(dab.get(0));

tree.root.left = new Node(dab.get(1));

tree.root.right = new Node(dab.get(2));

tree.root.left.left = new Node(dab.get(3));

tree.root.left.right = new Node(dab.get(4));

System.out.println("Preorder traversal of the Distance is ");

tree.printPreorder();

System.out.println("\nInorder traversal of Distance is ");

tree.printInorder();

System.out.println("\nPostorder traversal of Distance is ");

tree.printPostorder();

System.out.println("\n");
}

package FinalProj;

import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;

import jxl.read.biff.BiffException;

public class sad extends JFrame {

private JPanel contentPane;


private JTextField textRate1;
private JLabel lblEnterPrefferedRate;
private JComboBox genre1;
String selectedgenre1;
String selectedgenre2;
String selectedconsole;
private JTextField textRate2;

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {
public void run() {
try {
sad frame = new sad();
frame.setVisible(true);

} catch (Exception e) {
e.printStackTrace();
}
}
});

}
public sad() {
setBackground(Color.WHITE);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 800, 680);
contentPane = new JPanel();
contentPane.setBackground(Color.LIGHT_GRAY);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);

JLabel lblMovieRecommenderSystem = new JLabel("GAME RECOMMENDER SYSTEM\r\n");


lblMovieRecommenderSystem.setHorizontalAlignment(SwingConstants.CENTER);
lblMovieRecommenderSystem.setForeground(Color.BLACK);
lblMovieRecommenderSystem.setFont(new Font("Agency FB", Font.BOLD, 40));
lblMovieRecommenderSystem.setBounds(10, 0, 764, 65);
contentPane.add(lblMovieRecommenderSystem);
JLabel lblE = new JLabel("ENTER GENRE :");
lblE.setForeground(Color.BLACK);
lblE.setFont(new Font("Agency FB", Font.BOLD, 40));
lblE.setBounds(31, 76, 386, 65);
contentPane.add(lblE);

textRate1 = new JTextField();


textRate1.setToolTipText("1960-2015\r\n");
textRate1.setFont(new Font("Agency FB", Font.PLAIN, 30));
textRate1.setForeground(Color.BLACK);
textRate1.setBackground(Color.GRAY);
textRate1.setOpaque(false);
textRate1.setBounds(468, 158, 206, 35);
contentPane.add(textRate1);
textRate1.setColumns(10);

textRate2 = new JTextField();


textRate2.setToolTipText("1960-2015\r\n");
textRate2.setOpaque(false);
textRate2.setForeground(Color.BLACK);
textRate2.setFont(new Font("Agency FB", Font.PLAIN, 30));
textRate2.setColumns(10);
textRate2.setBackground(Color.GRAY);
textRate2.setBounds(468, 272, 206, 35);
contentPane.add(textRate2);

lblEnterPrefferedRate = new JLabel("ENTER RATING FOR THE GENRE :");


lblEnterPrefferedRate.setForeground(Color.BLACK);
lblEnterPrefferedRate.setFont(new Font("Agency FB", Font.BOLD, 40));
lblEnterPrefferedRate.setBounds(31, 140, 427, 65);
contentPane.add(lblEnterPrefferedRate);

JLabel label = new JLabel("ENTER GENRE :");


label.setForeground(Color.BLACK);
label.setFont(new Font("Agency FB", Font.BOLD, 40));
label.setBounds(31, 198, 386, 65);
contentPane.add(label);

JLabel label_1 = new JLabel("ENTER RATING FOR THE GENRE :");


label_1.setForeground(Color.BLACK);
label_1.setFont(new Font("Agency FB", Font.BOLD, 40));
label_1.setBounds(31, 256, 427, 65);
contentPane.add(label_1);

JLabel lblEnterGameConsole = new JLabel("ENTER GAME CONSOLE :");


lblEnterGameConsole.setForeground(Color.BLACK);
lblEnterGameConsole.setFont(new Font("Agency FB", Font.BOLD, 40));
lblEnterGameConsole.setBounds(31, 318, 386, 65);
contentPane.add(lblEnterGameConsole);

genre1 = new JComboBox(new Object[]{});


genre1.setModel(new DefaultComboBoxModel(new String[] {"-- Select Genre
--", "Action", "Adventure", "Baseball", "Battle", "Board", "Card", "Casino", "Compilation",
"Educational", "Fighting", "Flight", "Hunting", "Music", "None", "Other", "Party", "Pinball",
"Platformer", "Productivity", "Puzzle", "Racing", "RPG", "Shooter", "Simulation", "Sports",
"Strategy", "Trivia", "Virtual Pet", "Wrestling", "First-Person"}));
genre1.setSelectedIndex(0);
genre1.setFont(new Font("Dialog", Font.PLAIN, 15));
genre1.setBackground(Color.LIGHT_GRAY);
genre1.setBounds(258, 88, 239, 38);
contentPane.add(genre1);

JComboBox genre2 = new JComboBox(new Object[]{});


genre2.setModel(new DefaultComboBoxModel(new String[] {"-- Select Genre
--", "Action", "Adventure", "Baseball", "Battle", "Board", "Card", "Casino", "Compilation",
"Educational", "Fighting", "Flight", "Hunting", "Music", "None", "Other", "Party", "Pinball",
"Platformer", "Productivity", "Puzzle", "Racing", "RPG", "Shooter", "Simulation", "Sports",
"Strategy", "Trivia", "Virtual Pet", "Wrestling", "First-Person"}));
genre2.setSelectedIndex(0);
genre2.setFont(new Font("Dialog", Font.PLAIN, 15));
genre2.setBackground(Color.LIGHT_GRAY);
genre2.setBounds(241, 216, 239, 38);
contentPane.add(genre2);
JComboBox console = new JComboBox(new Object[]{});
console.setModel(new DefaultComboBoxModel(new String[] {"-- Select
Console --", "Android", "Dreamcast", "Game Boy Color", "GameCube", "Genesis", "iPad",
"iPhone", "Lynx", "Macintosh", "NeoGeo", "NeoGeo Pocket Color", "Nintendo 3DS", "Nintendo 64",
"Nintendo DS", "Nintendo DSi", "PC", "PlayStation", "PlayStation 2", "PlayStation 3", "PlayStation 4",
"PlayStation Portable", "PlayStation Vita", "Saturn", "Super NES", "TurboGrafx-16", "Wii", "Wii U",
"Wireless", "Xbox", "Xbox 360", "Xbox One"}));
console.setSelectedIndex(0);
console.setFont(new Font("Dialog", Font.PLAIN, 15));
console.setBackground(Color.LIGHT_GRAY);
console.setBounds(359, 334, 239, 38);
contentPane.add(console);

JTextArea textArea = new JTextArea();


textArea.setFont(new Font("Agency FB", Font.BOLD, 20));
textArea.setEditable(false);
textArea.setForeground(Color.WHITE);
textArea.setBackground(Color.BLACK);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setBounds(41, 393, 343, 240);
contentPane.add(scrollPane);

JButton btnGenerate = new JButton("GENERATE");


btnGenerate.addActionListener(new ActionListener() {
@SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent e) {

Queue<String> ansArr = new LinkedList<>();


ArrayList<Double> scoreArr = new ArrayList<>();
ArrayList<String> gameArr = new ArrayList<>();

double ansRt = Double.parseDouble(textRate1.getText());


double ansRt1 = Double.parseDouble(textRate2.getText());

scoreArr.add(ansRt);
scoreArr.add(ansRt1);

String type1 = null;


String type2= null;
String typeofConsole = null;
selectedgenre1 = (String) genre1.getSelectedItem();
if(selectedgenre1.contains("Action")) {
type1="Action";
ansArr.add(type1);
}
if(selectedgenre1.contains("Adventure")) {
type1="Adventure";
ansArr.add(type1);
}
if(selectedgenre1.contains("Baseball")) {
type1="Baseball";
ansArr.add(type1);
}
if(selectedgenre1.contains("Battle")) {
type1="Battle";
ansArr.add(type1);
}
if(selectedgenre1.contains("Board")) {
type1="Board";
ansArr.add(type1);
}
if(selectedgenre1.contains("Card")) {
type1="Card";
ansArr.add(type1);
}
if(selectedgenre1.contains("Casino")) {
type1="Casino";
ansArr.add(type1);
}
if(selectedgenre1.contains("Compilation")) {
type1="Compilation";
ansArr.add(type1);
}
if(selectedgenre1.contains("Education")) {
type1="Education";
ansArr.add(type1);
}
if(selectedgenre1.contains("Fighting")) {
type1="Fighting";
ansArr.add(type1);
}
if(selectedgenre1.contains("Flight")) {
type1="Flight";
ansArr.add(type1);
}
if(selectedgenre1.contains("Hunting")) {
type1="Hunting";
ansArr.add(type1);
}
if(selectedgenre1.contains("Music")) {
type1="Music";
ansArr.add(type1);
}
if(selectedgenre1.contains("None")) {
type1="None";
ansArr.add(type1);
}
if(selectedgenre1.contains("Other")) {
type1="Other";
ansArr.add(type1);
}
if(selectedgenre1.contains("Party")) {
type1="Party";
ansArr.add(type1);
}
if(selectedgenre1.contains("Pinball")) {
type1="Pinball";
ansArr.add(type1);
}
if(selectedgenre1.contains("Platformer")) {
type1="Platformer";
ansArr.add(type1);
}
if(selectedgenre1.contains("Productivity")) {
type1="Productivity";
ansArr.add(type1);
}
if(selectedgenre1.contains("Puzzle")) {
type1="Puzzle";
ansArr.add(type1);
}
if(selectedgenre1.contains("Racing")) {
type1="Racing";
ansArr.add(type1);
}
if(selectedgenre1.contains("RPG")) {
type1="RPG";
ansArr.add(type1);
}
if(selectedgenre1.contains("Shooter")) {
type1="Shooter";
ansArr.add(type1);
}
if(selectedgenre1.contains("Simulation")) {
type1="Simulation";
ansArr.add(type1);
}
if(selectedgenre1.contains("Sports")) {
type1="Sports";
ansArr.add(type1);
}
if(selectedgenre1.contains("Strategy")) {
type1="Strategy";
ansArr.add(type1);
}
if(selectedgenre1.contains("Trivia")) {
type1="Trivia";
ansArr.add(type1);
}
if(selectedgenre1.contains("Virtual Pet")) {
type1="Virtual Pet";
ansArr.add(type1);
}
if(selectedgenre1.contains("Wrestling")) {
type1="Wrestling";
ansArr.add(type1);
}
if(selectedgenre1.contains("First-Person")) {
type1="First-Person";
ansArr.add(type1);
}
selectedgenre2 = (String) genre2.getSelectedItem();
if(selectedgenre2.contains("Action")) {
type1="Action";
ansArr.add(type1);
}
if(selectedgenre1.contains("Adventure")) {
type1="Adventure";
ansArr.add(type1);
}
if(selectedgenre1.contains("Baseball")) {
type1="Baseball";
ansArr.add(type1);
}
if(selectedgenre1.contains("Battle")) {
type1="Battle";
ansArr.add(type1);
}
if(selectedgenre1.contains("Board")) {
type1="Board";
ansArr.add(type1);
}
if(selectedgenre1.contains("Card")) {
type1="Card";
ansArr.add(type1);
}
if(selectedgenre1.contains("Casino")) {
type1="Casino";
ansArr.add(type1);
}
if(selectedgenre1.contains("Compilation")) {
type1="Compilation";
ansArr.add(type1);
}
if(selectedgenre1.contains("Education")) {
type1="Education";
ansArr.add(type1);
}
if(selectedgenre1.contains("Fighting")) {
type1="Fighting";
ansArr.add(type1);
}
if(selectedgenre1.contains("Flight")) {
type1="Flight";
ansArr.add(type1);
}
if(selectedgenre1.contains("Hunting")) {
type1="Hunting";
ansArr.add(type1);
}
if(selectedgenre1.contains("Music")) {
type1="Music";
ansArr.add(type1);
}
if(selectedgenre1.contains("None")) {
type1="None";
ansArr.add(type1);
}
if(selectedgenre1.contains("Other")) {
type1="Other";
ansArr.add(type1);
}
if(selectedgenre1.contains("Party")) {
type1="Party";
ansArr.add(type1);
}
if(selectedgenre1.contains("Pinball")) {
type1="Pinball";
ansArr.add(type1);
}
if(selectedgenre1.contains("Platformer")) {
type1="Platformer";
ansArr.add(type1);
}
if(selectedgenre1.contains("Productivity")) {
type1="Productivity";
ansArr.add(type1);
}
if(selectedgenre1.contains("Puzzle")) {
type1="Puzzle";
ansArr.add(type1);
}
if(selectedgenre1.contains("Racing")) {
type1="Racing";
ansArr.add(type1);
}
if(selectedgenre1.contains("RPG")) {
type1="RPG";
ansArr.add(type1);
}
if(selectedgenre1.contains("Shooter")) {
type1="Shooter";
ansArr.add(type1);
}
if(selectedgenre1.contains("Simulation")) {
type1="Simulation";
ansArr.add(type1);
}
if(selectedgenre1.contains("Sports")) {
type1="Sports";
ansArr.add(type1);
}
if(selectedgenre1.contains("Strategy")) {
type1="Strategy";
ansArr.add(type1);
}
if(selectedgenre1.contains("Trivia")) {
type1="Trivia";
ansArr.add(type1);
}
if(selectedgenre1.contains("Virtual Pet")) {
type1="Virtual Pet";
ansArr.add(type1);
}
if(selectedgenre1.contains("Wrestling")) {
type1="Wrestling";
ansArr.add(type1);
}
if(selectedgenre1.contains("First-Person")) {
type1="First-Person";
ansArr.add(type1);
}

selectedgenre2 = (String) genre2.getSelectedItem();


if(selectedgenre2.contains("Action")) {
type2="Action";
ansArr.add(type2);
}
if(selectedgenre2.contains("Adventure")) {
type2="Adventure";
ansArr.add(type2);
}
if(selectedgenre2.contains("Baseball")) {
type2="Baseball";
ansArr.add(type2);
}
if(selectedgenre2.contains("Battle")) {
type2="Battle";
ansArr.add(type2);
}
if(selectedgenre2.contains("Board")) {
type2="Board";
ansArr.add(type2);
}
if(selectedgenre2.contains("Card")) {
type2="Card";
ansArr.add(type2);
}
if(selectedgenre2.contains("Casino")) {
type2="Casino";
ansArr.add(type2);
}
if(selectedgenre2.contains("Compilation")) {
type2="Compilation";
ansArr.add(type2);
}
if(selectedgenre2.contains("Education")) {
type2="Education";
ansArr.add(type2);
}
if(selectedgenre2.contains("Fighting")) {
type2="Fighting";
ansArr.add(type2);
}
if(selectedgenre2.contains("Flight")) {
type2="Flight";
ansArr.add(type2);
}
if(selectedgenre2.contains("Hunting")) {
type2="Hunting";
ansArr.add(type2);
}
if(selectedgenre2.contains("Music")) {
type2="Music";
ansArr.add(type2);
}
if(selectedgenre2.contains("None")) {
type2="None";
ansArr.add(type2);
}
if(selectedgenre2.contains("Other")) {
type2="Other";
ansArr.add(type2);
}
if(selectedgenre2.contains("Party")) {
type2="Party";
ansArr.add(type2);
}
if(selectedgenre2.contains("Pinball")) {
type2="Pinball";
ansArr.add(type2);
}
if(selectedgenre2.contains("Platformer")) {
type2="Platformer";
ansArr.add(type2);
}
if(selectedgenre2.contains("Productivity")) {
type2="Productivity";
ansArr.add(type2);
}
if(selectedgenre2.contains("Puzzle")) {
type2="Puzzle";
ansArr.add(type2);
}
if(selectedgenre2.contains("Racing")) {
type2="Racing";
ansArr.add(type2);
}
if(selectedgenre2.contains("RPG")) {
type2="RPG";
ansArr.add(type2);
}
if(selectedgenre2.contains("Shooter")) {
type2="Shooter";
ansArr.add(type2);
}
if(selectedgenre2.contains("Simulation")) {
type2="Simulation";
ansArr.add(type2);
}
if(selectedgenre2.contains("Sports")) {
type2="Sports";
ansArr.add(type2);
}
if(selectedgenre2.contains("Strategy")) {
type2="Strategy";
ansArr.add(type2);
}
if(selectedgenre2.contains("Trivia")) {
type2="Trivia";
ansArr.add(type2);
}
if(selectedgenre2.contains("Virtual Pet")) {
type2="Virtual Pet";
ansArr.add(type2);
}
if(selectedgenre2.contains("Wrestling")) {
type2="Wrestling";
ansArr.add(type2);
}
if(selectedgenre2.contains("First-Person")) {
type2="First-Person";
ansArr.add(type2);
}

selectedconsole = (String) console.getSelectedItem();


if(selectedconsole.contains("Android")) {
typeofConsole="Android";
}
if(selectedconsole.contains("Dreamcast")) {
typeofConsole="Dreamcast";
}
if(selectedconsole.contains("Game Boy Color")) {
typeofConsole="Game Boy Color";
}
if(selectedconsole.contains("GameCube")) {
typeofConsole="GameCube";
}
if(selectedconsole.contains("Genesis")) {
typeofConsole="Genesis";
}
if(selectedconsole.contains("iPad")) {
typeofConsole="iPad";
}
if(selectedconsole.contains("iPhone")) {
typeofConsole="iPhone";
}
if(selectedconsole.contains("Lynx")) {
typeofConsole="Lynx";
}
if(selectedconsole.contains("Macintosh")) {
typeofConsole="Macintosh";
}
if(selectedconsole.contains("NeoGeo")) {
typeofConsole="NeoGeo";
}
if(selectedconsole.contains("NeoGeo Pocket Color")) {
typeofConsole="NeoGeo Pocket Color";
}
if(selectedconsole.contains("Nintendo 3DS")) {
typeofConsole="Nintendo 3DS";
}
if(selectedconsole.contains("Nintendo 64")) {
typeofConsole="Nintendo 64";
}
if(selectedconsole.contains("Nintendo DS")) {
typeofConsole="Nintendo DS";
}
if(selectedconsole.contains("Nintendo DSi")) {
typeofConsole="Nintendo DSi";
}
if(selectedconsole.contains("PC")) {
typeofConsole="PC";
}
if(selectedconsole.contains("PlayStation")) {
typeofConsole="PlayStation";
}
if(selectedconsole.contains("PlayStation 2")) {
typeofConsole="PlayStation 2";
}
if(selectedconsole.contains("PlayStation 3")) {
typeofConsole="PlayStation 3";
}
if(selectedconsole.contains("PlayStation 4")) {
typeofConsole="PlayStation 4";
}
if(selectedconsole.contains("PlayStation Portable")) {
typeofConsole="PlayStation Portable";
}
if(selectedconsole.contains("PlayStation Vita")) {
typeofConsole="PlayStation Vita";
}
if(selectedconsole.contains("Saturn")) {
typeofConsole="Saturn";
}
if(selectedconsole.contains("Super NES")) {
typeofConsole="Super NES";
}
if(selectedconsole.contains("TurboGrafx-16")) {
typeofConsole="TurboGrafx-16";
}
if(selectedconsole.contains("Wii")) {
typeofConsole="Wii";
}
if(selectedconsole.contains("Wii U")) {
typeofConsole="Wii U";
}
if(selectedconsole.contains("Wireless")) {
typeofConsole="Wireless";
}
if(selectedconsole.contains("Xbox")) {
typeofConsole="Xbox";
}
if(selectedconsole.contains("Xbox 360")) {
typeofConsole="Xbox 360";
}
if(selectedconsole.contains("Xbox One")) {
typeofConsole="Xbox One";
}

LastGame test= new LastGame();


test.setInputFile("D:\\Downloads\\CS201Project\\hatdog.xls");
try {

gameArr.addAll(test.read(ansArr, scoreArr,typeofConsole));
for(String a : gameArr){
textArea.append(a + "\n");
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (BiffException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnGenerate.setForeground(Color.BLACK);
btnGenerate.setFont(new Font("Tahoma", Font.BOLD, 20));
btnGenerate.setBackground(Color.LIGHT_GRAY);
btnGenerate.setBounds(440, 393, 316, 55);
contentPane.add(btnGenerate);

JLabel lblClickHereTo = new JLabel("CLICK TO GENERATE RECOMMENDED GAMES");


lblClickHereTo.setForeground(Color.BLACK);
lblClickHereTo.setFont(new Font("Verdana", Font.PLAIN, 10));
lblClickHereTo.setBounds(483, 451, 255, 27);
contentPane.add(lblClickHereTo);

}}
Members Information

Lagao, Ronald Jay C.


ronaldlagao09@gmail.com
09455474915

Adona, Lance Gabriel B.


adonalance.la@gmail.com
09150425386
Abejuro, August Eldred A.
augusteldreda@gmail.com
09567141881

You might also like