TutorMe homepage
Subjects
PRICING
COURSES
Start Free Trial
Vemula S.
I am an undergraduate at Birla Institute of Technology and Sciences, Pilani, one of the most reputed colleges in India.
Tutor Satisfaction Guarantee
Java Programming
TutorMe
Question:

Given a string argument of the form 201#5 to a constructor of a class which is used for initializing the instance variables. Here 201 represents ID and 5 represent some other instance variable. Write the constructor class assuming the following. Class name = Track Instance fields = trackID , length. Constructor Track(track : String); Track(String track){ // Complete this part } Assume all required imports are done.

Vemula S.

Track(String track){ StringTokenizer st = new StringTokenizer(track, "#"); this.trackID = Integer.parseInt(st.nextToken()); this.lengthMin = Integer.parseInt(st.nextToken()); }

Geometry
TutorMe
Question:

ABC is a right angled triangle, right angle at A.AB = 24 and AC = 18.D is a point in between B and C S.T triangles ADB and ADC have equal perimetres. Determine the length of AD.

Vemula S.

You can draw out the triangle on a piece of paper. Join the points connecting A and D.Now assume a variable x equals to AD and BD equals to some other variable (say y ). Now if you know the great pythagorean theorem, next part becomes simple. BC*BC = AB*AB + AC*AC BC becomes 30. Now solve for y and we get , y + x + 24 = 18 + x + 30 - y 2y = 24 -> y = 12 Now comes the cosine rule. you can read about it here -> https://en.wikipedia.org/wiki/Law_of_cosines Now using cosine rule on both triangles ABC and ABD, cos(angle) = (24*24 + 30*30 - 18*18)/(2*24*30) = (24*24 + 12*12 - x*x)/(2*24*12) Solving for x we get, x = 16.09 or 36/root(5).

C++ Programming
TutorMe
Question:

What are the differences between a C struct and a C++ struct ?

Vemula S.

C struct is just a way of putting data together, it only has the data and does not include the functionality (other functions can use this struct anyway! ). A C++ struct is actually a class difference being class defaults to private whereas struct defaults to public.

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