Mcsl-054 Laboratory Course Essay

essay A+
  • Words: 1711
  • Category: C++

  • Pages: 7

Get Full Essay

Get access to this section to get all the help you need with your essay and educational goals.

Get Access

Course Code Course Title Assignment Number : : : MCSL-054 Laboratory Course MCA(5)/L054/Assign/2011 Question 1: Write a Servlet program for session tracking using cookies. Hint : package hall; import java. io. *; import javax. servlet. *; import javax. servlet. http. *; import java. net. *; import java. util. *; public class ShowSession extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request. getSession(true); response. etContentType(“text/html”); PrintWriter out = response. getWriter(); String title = “Searching the Web”; String heading; Integer accessCount = new Integer(0);; if (session. isNew()) { heading = “Welcome, Newcomer”; } else { heading = “Welcome Back”; Integer oldAccessCount = (Integer)session. getValue(“accessCount”); if (oldAccessCount ! = null) { accessCount = new Integer(oldAccessCount. intValue() + 1); } } // Use putAttribute in version 2. 2 of servlet API. session. putValue(“accessCount”, accessCount); out. println(ServletUtilities. eadWithTitle(title) + ”
” + “” + heading + ”
” + “Information on Your Session:
” + ”
” + ”
” + ” Info TypeValue
” + ”
” + ” ID
” + ” ” + session. getId() + ”
” + ”
” + ” Creation Time
” + ” ” + new Date(session. getCreationTime()) + ”
” + ”
” + ” Time of Last Access
” + ” ” + new Date(session. getLastAccessedTime()) + ”
” + ”
” + ” Number of Previous Accesses
” + ” ” + accessCount + ”
” + ”
” + “”); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }

Question 2: Write a JSP Program, which displays a web page containing two web links one for showing details of your Study Centre and other for FAQs on Practicls in MCA Programme . When one click on link Study Centre it goes to a page which shows all the details of study centre and counselling schedule for MCA students . Clicking on link for FAQs on Practicls in MCA ,another JSP page consisting of some FAQ related to different practical courses in MCA, will open. Hint : Main. jsp Main View Details of study center View Faq on MCA Practils etailofstudycenter. jsp Student Centre Detail Page: Study Centre Name : Solutioncab Technologies Address : Solutioncab technologies, jaipur Rajasthan Phone Number : 0141-25699002 Email : [email protected] com Program Coordinator : Praveen kumar counselling schedule for MCA : click here faqonpracticls. jsp FAQs FAQs on Practicls Q1. If attendance is less than 75% in practical session of a course due to some reasons can student get any help/consideration? Ans : The student will NOT be allowed to appear in Term-End Practical Exam. Q2.

If Attendance is less than 75% then how can a student give Term-End Practical Exam? Ans : The student will NOT be allowed to appear in Term-End Practical Exam. Q3. Can the MCA students appear in the Term-End Practical Exam without filling the TermEnd Exam Form ? Ans : No. Q4. What should we do to give my Backlog Term End Practical Exam ? Ans : Collect attendance proof from the study Centre & then submit to IGNOU Regional Centre before your Term End Examination (Theory). Question 3:Write a program using JSP and JDBC to provide details of MCA/BCA/CIT study centres in your regional centre of IGNOU.

This program should provide the list of students in different semesters of MCA/BCA/CIT. Hint: index. jsp Select your regional center Please select one page2. jsp JSP Page Back Student details for different semester(MCA,BCA and CIT) regional center wise Study center details Id Name Address page3. jsp JSP Page Back Student details Id Name Gender Age Address Course Semester page4. jsp JSP Page Back Student details Id Name Gender Age Address Course Semester DBConnection. java package database; import java. sql. ; public class DBConnection { /** Creates a new instance of DBConnection */ public DBConnection() { } public static Connection getDBConnection() { Connection con = null; try { Class. forName(“com. mysql. jdbc. Driver”); } catch(ClassNotFoundException e) { System. out. println(“Could not load driver class “+e); } try { con = DriverManager. getConnection(“jdbc:mysql://localhost:3306/ignou”,”root”,”root”); } catch (SQLException e) {System. out. println(“Could not get connection “+e);} return con; } public static void closeDBConnection(Connection con) { try { if(con! null) con. close(); } catch (SQLException e) { System. out. println(“Could not close connection “+e); } } public static void main(String[] args) { getDBConnection(); } } ignou. sql CREATE DATABASE IF NOT EXISTS ignou; USE ignou; DROP TABLE IF EXISTS `ignou`. `courses`; CREATE TABLE `ignou`. `courses` ( `cid` int(11) NOT NULL AUTO_INCREMENT, `cname` varchar(100) DEFAULT NULL, PRIMARY KEY (`cid`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; LOCK TABLES `courses` WRITE; INSERT INTO `ignou`. courses` VALUES (2,’BCA’), (3,’CIT’), (1,’MCA’); UNLOCK TABLES; DROP TABLE IF EXISTS `ignou`. `regionalcenter`; CREATE TABLE `ignou`. `regionalcenter` ( `rid` int(11) NOT NULL AUTO_INCREMENT, `rname` varchar(100) DEFAULT NULL, `address` text, PRIMARY KEY (`rid`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; LOCK TABLES `regionalcenter` WRITE; INSERT INTO `ignou`. `regionalcenter` VALUES (1,’Jaipur’,’Mansarovar Jaipur’), (2,’Mumbai’,’Mulund Mumbai’); UNLOCK TABLES; DROP TABLE IF EXISTS `ignou`. `student`; CREATE TABLE `ignou`. student` ( `name` varchar(100) DEFAULT NULL, `gender` varchar(6) DEFAULT NULL, `age` int(11) DEFAULT NULL, `address` text, `cid` int(11) DEFAULT NULL, `sid` int(11) DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, `sem` int(11) DEFAULT NULL, `rid` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; LOCK TABLES `student` WRITE; INSERT INTO `ignou`. `student` VALUES (‘Meena’,’Female’,25,’Mumbai (MH)’,2,2,2,4,2), (‘Deepak’,’Male’,25,’Alsisar, Jhunjhunu (Rajasthan)’,1,1,1,5,1); UNLOCK TABLES; DROP TABLE IF EXISTS `ignou`. studycenter`; CREATE TABLE `ignou`. `studycenter` ( `address` text, `sid` int(11) NOT NULL, `sname` varchar(100) DEFAULT NULL, `rid` int(11) DEFAULT NULL, PRIMARY KEY (`sid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; LOCK TABLES `studycenter` WRITE; INSERT INTO `ignou`. `studycenter` VALUES (‘Jaipur’,1,’IIIM’,1), (‘Mumbai’,2,’ABCD’,2); UNLOCK TABLES; Question 4: Create an XML document for keeping books records in a Library. Hint: Gambardella, Matthew XML Developer’s Guide Computer 44. 95 2000-10-01 An in-depth look at creating applications with XML. Ralls, Kim Midnight Rain Fantasy 5. 5 2000-12-16 A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world. Corets, Eva Maeve Ascendant Fantasy 5. 95 2000-11-17 After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society. PART-II: Lab for MCS-053 (Computer Graphics and Multimedia) Question 1:Write a program in C/C++ using OpenGL to draw a circle of red colour inside of a rectangle of blue colour on a background of green colour. Hint: Question 2:Write a program in C or C++ to implement Scan-Line Polygon Filling Algorithm.

Hint: Write a program in C or C++ to implement Scan-Line Polygon Filling Algorithm Answer typedef struct tEdge { int yUpper; float xIntersect, dxPerScan; struct tEdge * next; } Edge; typedef struct tdcPt { int x; int y; } dcPt; void scanFill (int cnt, dcPt * pts) { Edge * edges[WINDOW_HEIGHT], * active; int i, scan; for (i=0; inext = NULL; } buildEdgeList (cnt, pts, edges); active = (Edge *) malloc (sizeof (Edge)); active-;next = NULL; for (scan=0; scannext) { fillScan (scan, active); updateActiveList (scan, active); resortActiveList (active); } /* Free edge records that have been malloc’ed … */ } void scanFill (int cnt, dcPt * pts) { Edge * edges[WINDOW_HEIGHT], * active; int i, scan; for (i=0; inext = NULL; } buildEdgeList (cnt, pts, edges); active = (Edge *) malloc (sizeof (Edge)); active-;next = NULL; for (scan=0; scannext) { fillScan (scan, active); updateActiveList (scan, active); resortActiveList (active); } } /* Free edge records that have been malloc’ed … */ } void buildEdgeList (int cnt, dcPt * pts, Edge * edges[]) { Edge * edge; dcPt v1, v2; int i, yPrev = pts[cnt – 2]. y; v1. x = pts[cnt-1]. x; v1. y = pts[cnt-1]. ; for (i=0; i (cnt-1)) j = 0; else j = k + 1; while (pts[k]. y == pts[j]. y) if ((j+1) ; (cnt-1)) j = 0; else j++; return (pts[j]. y); } void buildEdgeList (int cnt, dcPt * pts, Edge * edges[]) { Edge * edge; dcPt v1, v2; int i, yPrev = pts[cnt – 2]. y; v1. x = pts[cnt-1]. x; v1. y = pts[cnt-1]. y; for (i=0; idxPerScan =(float) (upper. x – lower. x) / (upper. y – lower. y); edge-;xIntersect = lower. x; if (upper. y ; yComp) edge-;yUpper = upper. y – 1; else edge-;yUpper = upper. y; insertEdge (edges[lower. y], edge); } /* Inserts edge into list in order of increasing xIntersect field. / void insertEdge (Edge * list, Edge * edge) { Edge * p, * q = list; p = q->next; while (p ! = NULL) { if (edge->xIntersect < p->xIntersect) p = NULL; else { q = p; p = p->next; } } edge->next = q->next; q->next = edge; } void scanFill (int cnt, dcPt * pts) { Edge * edges[WINDOW_HEIGHT], * active; int i, scan; for (i=0; inext = NULL; } buildEdgeList (cnt, pts, edges); active = (Edge *) malloc (sizeof (Edge)); active->next = NULL; for (scan=0; scannext) { fillScan (scan, active); updateActiveList (scan, active); resortActiveList (active); } /* Free edge records that have been malloc’ed … */ void buildActiveList (int scan, Edge * active, Edge * edges[]) { Edge * p, * q; p = edges[scan]-;next; while (p) { q = p-;next; insertEdge (active, p); p = q; } } void scanFill (int cnt, dcPt * pts) { Edge * edges[WINDOW_HEIGHT], * active; int i, scan; for (i=0; inext = NULL; } buildEdgeList (cnt, pts, edges); active = (Edge *) malloc (sizeof (Edge)); active-;next = NULL; for (scan=0; scannext) { fillScan (scan, active); updateActiveList (scan, active); resortActiveList (active); } } /* Free edge records that have been malloc’ed … / } void fillScan (int scan, Edge * active) { Edge * p1, * p2; int i; p1 = active->next; while (p1) { p2 = p1->next; for (i=p1->xIntersect; ixIntersect; i++) setPixel ((int) i, scan); p1 = p2->next; } } void scanFill (int cnt, dcPt * pts) { Edge * edges[WINDOW_HEIGHT], * active; int i, scan; for (i=0; inext = NULL; } buildEdgeList (cnt, pts, edges); active = (Edge *) malloc (sizeof (Edge)); active->next = NULL; for (scan=0; scannext) { fillScan (scan, active); updateActiveList (scan, active); resortActiveList (active); } } /* Free edge records that have been malloc’ed … / } /* Delete completed edges. Update ’xIntersect’ field for others */ void updateActiveList (int scan, Edge * active) { Edge * q = active, * p = active-;next; while (p) if (scan ;= p-;yUpper) { p = p-;next; deleteAfter (q); } else { p-;xIntersect = p-;xIntersect + p-;dxPerScan; q = p; p = p-;next; } } void deleteAfter (Edge * q) Edge * p = q-;next; q-;next = p-;next; free (p); } void scanFill (int cnt, dcPt * pts) { Edge * edges[WINDOW_HEIGHT], * active; int i, scan; for (i=0; inext = NULL; } buildEdgeList (cnt, pts, edges); active = (Edge *) malloc (sizeof (Edge)); active-;next = NULL; for (scan=0; scannext) { fillScan (scan, active); updateActiveList (scan, active); resortActiveList (active); } } /* Free edge records that have been malloc’ed … */ } void resortActiveList (Edge * active) { Edge * q, * p = active-;next; active-;next = NULL; while (p) { q = p-;next; insertEdge (active, p); p = q; } }

Question 3: Write a program in C/C++ using OpenGL to draw a hard wire diagram as shown in figure given below. Use basic primitives of openGL. 120 40 40 120 Question 4:Write a program in C/C++ using OpenGL to perform a 3-Dimensional transformation, such as translation ,rotation and reflection, on a given triangle. Hint: #include #include #include #include void draw3d(int fs,int x[20],int y[20],int tx,int ty,int d); void draw3d(int fs,int x[20],int y[20],int tx,int ty,int d) { int i,j,k=0; for(j=0;j

Get instant access to
all materials

Become a Member
unlock