Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Adrian L.
Experienced software engineer and entrepreneur
Tutor Satisfaction Guarantee
Web Development
TutorMe
Question:

What is an API and how are they useful in the context of developing a web application? Discuss how a web API might be used in the context of a web application's client-side and server-side processes.

Adrian L.
Answer:

APIs allow a web application send data between the client and server. APIs can also be used to enable a web application to communicate with another application or web service. As an example, a To-Do list web application (which might be written in Javascript) could use an API provided by the web server to obtain a list of To-Do list items to display to the user. When the user adds a To-Do item, another API call might be made to save that To-Do item which would involve making an API request containing the To-Do list item data. The request is received by the server and the data (To-Do list item and potentially other associated data) could then be saved to the database.

Javascript Programming
TutorMe
Question:

Javascript is a dynamically typed language? Explain what this means and give some example Javascript code creating variables with 3 different types (e.g. number, string, object).

Adrian L.
Answer:

Dynamic typing means that the data type (number, string, object, etc.) of a variable is not defined explicitly in the code. Instead the type is dynamically assigned based on the value being stored in a given variable. The type of a variable may change throughout the execution of a program. var myVariable = 5; // Here the type of myVariable is number myVariable = "hello"; // Here the type of myVariable is string myVariable = {"name": "Bob", "age": 45}; // Here the type of myVariable is object

Java Programming
TutorMe
Question:

Design a Java object to represent a playing card from a normal deck of cards. The object should have a constructor method where you pass two parameters to define the type of card, a number and a suit. For example: To create a king of spades: Card newCard = new Card("K", "spades"); To create a 10 of hearts: Card newCard = new Card("10", "hearts"); The card should have one method called getNumericValue() which returns the numeric value of the card (ace is one, and all face cards should have a value of 10). Also write a toString() method to represent the card as a string (e.g. "10 of hearts").

Adrian L.
Answer:

public class Card { private String value; private String suit; public Card(String value, String suit) { // it would be best to validate the values here so its impossible // to create cards with invalid values (e.g. "X" and "black"). this.value = value; this.suit = suit; } public int getNumericValue() { int numericValue; switch (value) { case "A": numericValue = 1; break; case "K": case "Q": case "J": numericValue = 10; break; default: numericValue = Integer.parseInt(value); break; } return numericValue; } }

Send a message explaining your
needs and Adrian will reply soon.
Contact Adrian
Ready now? Request a lesson.
Start Session
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 Session" 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.