Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I was wondering how to read a text file into Java using a buffered reader and then put the information into two different stacks (group1

I was wondering how to read a text file into Java using a buffered reader and then put the information into two different stacks (group1 and group2) each with four people. My plan is to use the GaleShapley algorithm to solve this problem.

Here is the problem I am trying to solve.

image text in transcribed

and here is the text file

image text in transcribedThanks!

Description In this project you will implement a stack and use it to solve the stable marriage problem using backtracking. We will address the stable marriage problem in class along with backtracking You are to explicitly use your stack to keep track of state in this implementation. Details Input to this problem will come from a file. The file contains the number of pairings to make and two arrays indicating the preferences of each side. The input data will come from a file "Project1TestData.txt" and will be formatted as follows 4 Bobbie number of pairings to make First person 's name in group A Bob's preferences (O - highest) Second person 's name in group A Ted Gina 3 2 10 Harry 0 2 13 Mel 3 2 1 0 Barb 2 13 O olive 2 3 10 Sam 2013 Your program is to determine a pairing where there exist no two programmers that are not paired but would prefer each other to their actual partners. Your output upon finding a suitable pairing should be a list of the team pairs. First person 's name in group B Mel 's preferences (O - highest) Team 0: Gina and Mel Team 1: Harry and Sam Team 2: Bobbie and Olive Team 3: Ted and Barb If no such pairing exists you should output the message No stable pairing exists. Program Guidelines Your main program should be in a class named Project1 Your name should be in the comments at the top of each source file Your variable names should be meaningful, they should reflect the usage or contents of the variable You should have Javadoc block comments for each class and non-trivial method Description In this project you will implement a stack and use it to solve the stable marriage problem using backtracking. We will address the stable marriage problem in class along with backtracking You are to explicitly use your stack to keep track of state in this implementation. Details Input to this problem will come from a file. The file contains the number of pairings to make and two arrays indicating the preferences of each side. The input data will come from a file "Project1TestData.txt" and will be formatted as follows 4 Bobbie number of pairings to make First person 's name in group A Bob's preferences (O - highest) Second person 's name in group A Ted Gina 3 2 10 Harry 0 2 13 Mel 3 2 1 0 Barb 2 13 O olive 2 3 10 Sam 2013 Your program is to determine a pairing where there exist no two programmers that are not paired but would prefer each other to their actual partners. Your output upon finding a suitable pairing should be a list of the team pairs. First person 's name in group B Mel 's preferences (O - highest) Team 0: Gina and Mel Team 1: Harry and Sam Team 2: Bobbie and Olive Team 3: Ted and Barb If no such pairing exists you should output the message No stable pairing exists. Program Guidelines Your main program should be in a class named Project1 Your name should be in the comments at the top of each source file Your variable names should be meaningful, they should reflect the usage or contents of the variable You should have Javadoc block comments for each class and non-trivial method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions