Enable contrast version

Tutor profile: Kris D.

Inactive
Kris D.
Software Engineer for 3 years
Tutor Satisfaction Guarantee

Questions

Subject: Java Programming

TutorMe
Question:

I have built some basic java programs before, in class today my professor was talking about constructors and how every class has one. I was confused about them and was hoping you might be able to explain them in a bit better detail.

Inactive
Kris D.
Answer:

So yes every class has a constructor when we don't provide one explicitly Java utilizes a default constructor. You have been utilizing constructors any time you create an object to utilize for example whenever you utilized the Java.util.Scanner when you initialize the Scanner you are using its parameterized constructor. Scanner scanner = new Scanner(System.in); When you say 'Scanner(System.in);' that is the constructor being used to initialize the scanner variable. A default constructor lets say we have a java class ExampleClass. The default constructor would look like this: ExampleClass exampleClass = new ExampleClass(); In our classes that we make we can overload the constructor to make as many as we may need. For example lets say we have an Employee class. This object only contains a Long for the id number and a String for the employee's name. In our code when we want to create a new employee from scratch we can create an empty employee that the user can then fill in. The other option in our code is to read in the name from a list, we still have to input his ID number though. So instead of creating an empty Employee object and filling it in for each in the list we can create a constructor that fills in the name if we pass it to it. For Example public class Employee{ private long id; private String name; public Employee() { } public Employee(String name) { this.name = name; } {...} } Now we can create a new Employee object with no information given when it is initialized or an employee name when it is initialized.

Subject: Computer Science (General)

TutorMe
Question:

What is recursion and how exactly does it work?

Inactive
Kris D.
Answer:

Recursion or a recursive function is a function that call upon itself in order to solve a problem. Interviewers really like it when candidates use recursion to solve problems however I have never seen it used in the field. It is very interesting though and it is a confusing concept at first. So I am going to break down a common recursion problem and attempt to explain how it works through each piece. A common recursion problem that I have seen a few variations of is the maze problem. Where in the code there is a maze and you have to find and mark the path leading to the exit. I will write some psudo code. (This piece I always do interactively where they help me write psuedo code). I would them walk them through the psuedo code and explain that every time the function is called its put on top of the stack until the base case is reached then it returns back and pops the top of the stack trace and continues with the previous calls code. (unfortunately this is difficult to convey without visual aids). There are a few issues you could face using this with bigger issues such as stack overflow, you also can eat up the machines resources and bog the entire system down. I have seen the later happen a few times.

Subject: C Sharp Programming

TutorMe
Question:

I have a phone application that I am building in Unity utilizing C# and it needs to be able to interact with a C# program on the PC. The PC program is not written in Unity and I want it to be able to interact directly with the PC program via wifi without going through anything else. The PC program needs to send an object to the phone application I have been researching and have seen talk about DLL's I was hoping you could give me more information about what a dll is and how I can implement it in my code.

Inactive
Kris D.
Answer:

Well DLL is short for Dynamic Link Library, it contains objects, functions, ect that can be used by multiple applications at once. In one of my side projects we had to create a DLL to normalize an object being sent via wifi. In this case we need to create a new project for our DLL, we now want to create a new class that will make up our DLL, in this case it looks like we need to create an object that we can utilize on both Unity and the PC. After we get the class and all necessary functions for the object completed we need to compile the code and in the bin/debug directory (unless defaulted elsewhere). We now will have our DLL. So now we need to take this DLL and make sure we reference it in both the Unity application and the C# application. For the pc application (I assume we are using Visual Studio) we need to go to our solution explorer right click on our solution and select "Add Reference". We will then select the DLL file to add it to the project. Now we can simply add our DLL to our code for the PC application by importing it via "Using <Name of DLL>" and now we can use it in our code we now just need to add it to the unity piece. Now when we have to serialize the object send it to the phone application via wifi and deserialize the object we can reference the DLL and get no errors.

Contact tutor

Send a message explaining your
needs and Kris will reply soon.
Contact Kris

Request lesson

Ready now? Request a lesson.
Start Lesson

FAQs

What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Lesson" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.
BEST IN CLASS SINCE 2015
TutorMe homepage
Made in California by Zovio
© 2013 - 2021 TutorMe, LLC
High Contrast Mode
On
Off