Enable contrast version

Tutor profile: Ketan K.

Inactive
Ketan K.
Tutor for 6.5 years at Engineering Institute
Tutor Satisfaction Guarantee

Questions

Subject: Java Programming

TutorMe
Question:

Write a java applet program that draws a rectangle that has a width of half the screen width, a height of half the screen height.

Inactive
Ketan K.
Answer:

In the solution of the given problem, I have used Applet and Graphics class Following is method of Graphics class which is used for drawing rectangle: void drawRect(int x, int y, int width, int height) x and y are left-top coodinates of rectangle width and height indicate width and height of rectangle. We need a rectangle which has a width of half the screen width, a height of half the screen height $$width = getSize().width / 2$$ $$height = getSize().height / 2$$ and need of rectangle always in the center of the screen, therefore, we need to identify left-top coordinates of rectangle i.e x and y $$x = getSize().width / 4$$ $$y = getSize().height / 4$$ Refer following java applet code: import java.applet.Applet; import java.awt.*; public class rectangle1 extends Applet { public void init() { setSize(300,200); repaint(); } public void paint(Graphics g) { int appW = getSize().width; int appH = getSize().height; int x = appW/4; int y = appH/4; int width = appW/2; int height = appH/2; g.drawRect(x, y,width,height); } }

Subject: Databases

TutorMe
Question:

Assume the database schema for malls in countries. A country has many malls, and the same mall chain is available in different countries. Country (ID: integer, Name: String (unique)) Mall (CountryID: Integer, MallName: String, ManagerID: Integer) How many candidate Key(s) in the Mall relation?

Inactive
Ketan K.
Answer:

Let's see how many Super Keys (Uniquely Identifies Rows) in Table: Mall 1. {CountryID} 2. {ManagerID} 3. {CountryID, MallName} 4. {ManagerID, MallName} 5.{CountryID, ManagerID, MallName} Let's select the candidate keys (minimal super key) from the above set of super keys. 1. {CountryID}: No redundant attribute Therefore it is Candidate Key 2. {ManagerID}: No redundant attribute Therefore it is Candidate Key 3. {CountryID, MallName} : Here MallName is redundant attribute. No need of this attribute. Only CountryID enough to uniquely identify the tuple in the relation 4. {ManagerID, MalllName} : Here also MallName is redundant attribute. No need of this attribute. Only ManagerID enough to uniquely identify the tuple in the relation 5. {CountryID, ManagerID, MallName}: Here also MallName is redundant attribute. No need of this attribute. Only CountryID or ManagerID enough to uniquely identify the tuple in the relation. Therefore in relation Mall : Two (2) candidate keys are present. (CountryID and ManagerID)

Subject: C Programming

TutorMe
Question:

Write a C program to find the reverse of the input string without using any string library function.

Inactive
Ketan K.
Answer:

#include<stdio.h> int main() { char input[20], reverse[20]; int begin, end, count = 0; //Accepting input from user printf("Enter any string:\n"); fgets(input,20,stdin); //Calculating string length while(input[count] != '\0') count++; end=count-1; for(begin=0; begin<count; begin++) { reverse[begin] = input[end]; end--; } reverse[begin] = '\0'; printf("%s\n", reverse); return 0; }

Contact tutor

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

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