Java Programming Language: The program is to be called Profile.java I could use a little help with
Question:
Java Programming Language: The program is to be called Profile.java
I could use a little help with my coding. Directions posted below.
Make a class namedProfile 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 storea person's name and age along with an array to store a record 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 themember variables.
- Public methods to mutate and access the member variables.
- A public method named toString( ) that returns a String containing an appropriate description of thedating profile record.
- A public method named equals( ) that determines whether twoprofiles are the same and returns a boolean.
- A public method swipeRight() that:
- takes in an 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
- 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.
- 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.
- takes in an instance of another Profile and adds the current Profile to the other Profile's like array.
- 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)
Then I need to 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 mainfor 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.
Cornerstones of Managerial Accounting
ISBN: 978-0324660135
3rd Edition
Authors: Mowen, Hansen, Heitger