Enable contrast version

# Tutor profile: Aniket M.

Inactive
Aniket M.
Oracle Certified Tutor/Trainer with 100+ reviews
Tutor Satisfaction Guarantee

## Questions

### Subject:Web Development

TutorMe
Question:

Create an object named 'Triangle' with variables 'length' and 'height'. Create a method inside it for taking input for 'length' and 'height'. Also, create a method for printing the area of a triangle.

Inactive
Aniket M.

In order to solve this problem, we need to understand Javascript objects JavaScript objects are containers for named values called properties or methods. We need to create two properties - length and height We also need 2 methods - one for taking the input and one for calculating the area. We know that the area of a Triangle is 1/2 * length * height or 0.5*length*height. First, we will create the object, and then to test it we will be calling its methods. CODE var Traingle={ length:0, width:0, take_input: function(len,wid) { this.length=len; this.width=wid; }, area:function() { console.log(0.5*this.length*this.width); } } Traingle.take_input(2,3); Traingle.area();

### Subject:Python Programming

TutorMe
Question:

Take 20 integer inputs from the user and print the following: list of positive numbers list of negative numbers list of odd numbers list of even numbers list of 0s.

Inactive
Aniket M.

In order to solve this problem, we need to first take user input for 20 numbers in a while loop, and then segregate the numbers on the basis of type. All the numbers > 0 will be added to the list of positive numbers. All the numbers < 0 will be added to the list of negative numbers. All the numbers whose remainder is 0, when divided by 2 will be added to the list of even numbers. All the numbers whose remainder is not 0, when divided by 2 will be added to the list of odd numbers. All the numbers = 0 will be added to the list of 0s CODE i=0 l0=[] leven=[] lodd=[] lneg=[] lpos=[] while i<20: a=int(input("Enter the number : ")) if a==0: l0.append(a) if a>0: lpos.append(a) if a<0: lneg.append(a) if a%2==0 and a!=0: leven.append(a) if a%2!=0 and a!=0: lodd.append(a) i=i+1 print(l0) print(leven) print(lodd) print(lneg) print(lpos)

### Subject:Java Programming

TutorMe
Question:

Create functions for the Calculator class that can do the following: Add two numbers. Subtract two numbers. Multiply two numbers. Divide two numbers. Notes The functions should return the result of the calculation.

Inactive
Aniket M.

To solve this problem, we need to create a Calculator class that contains 4 functions. Each of the functions must be independent and must return a value. eg -> add(int num1,int num2) takes 2 integers as parameters and returns the sum. In the Main class, we also have to create an object of Calculator class in order to test these methods. Note: In the case of division, we have to consider the scenario when number2 is 0. That means in Main class, we will check if number2 is 0, then we will be printing Error. CODE: class Calculator { public int add (int num1, int num2) { int add = num1 + num2; return add; } public int subtract (int num1, int num2) { int sum = num1 - num2; return sum; } public int multiply (int num1, int num2) { int prod= num1 * num2; return prod; } public int divide (int num1, int num2) { int div= num1 / num2; return div; } } public class Main{ public static void main(String[] args) { Calculator calc = new Calculator(); System.out.println(calc.add(10,5)); System.out.println(calc.subtract(10,5)); System.out.println(calc.multiply(10,5)); int a=10; int b=5; if (b!=0) System.out.println(calc.divide(10,5)); else System.out.println("Error"); } }

## Contact tutor

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

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