Blog
Profile Matching- simple “dating app” simulation
I have some components provided in zip- main focus is swipeRight() and swipeLeft()
Create a class named Profile that stores relevant information and methods for a single person’s
profile on a dating app like Tinder. This will be a simplified version of what the object structure of
a dating app could look like.
Your class should contain the following:
• Private member variables to store a person’s name and age along with an array to store arecord of other profiles that have swiped right on them, and a second array to store a
record of matches (profiles where both profiles have swiped right on eachother). You
can assume that each profile is only allowed to have 10 likes and matches at a time.
A default and overloaded constructor(s) that set the member variables.
Public methods to mutate and access the member variables.
A public method named toString( ) that returns a String containing an appropriate
description of the dating profile record.
• A public method named equals( ) that determines whether two profiles are the same and
returns a boolean.
• A public method swipeRight() that:
o takes in a instance of another Profile and adds the current Profile to the other
Profile’s like array.
▪ e.g. if you call alex.swipeRight(sam), you would add alex into sam’s like
array
o If the Profile is already in the other like array, add the Profile to the match array of
both Profiles.
▪ e.g. if sam had already liked alex (sam was in alex’s like array), then add
alex into sam’s match array and sam into alex’s match array.
o Be sure to make sure the position in the array you are inserting is null(otherwise
you will overwrite an existing match). If there is no room in one of the match
arrays, tell the user the match cannot be made.
• A public method swipeLeft() that takes in an instance of another dating profile and deletes
that profile from the current Profile’s like array. (It does nothing with the matched array)
Write test code (in the main method) to create two or more dating profiles and simulate the
matching process by calling either the swipeRight() or swipeLeft() methods for each instance,
then printing out each object’s match arrays. The only purpose of main for this program is to
instantiate instances of your class and invoke methods specified in the class, the rest of the
matching logic should occur in your object’s methods.