1
Section 1: OOAD Lab
Q1: (a) Draw Class Diagram for Online Examination System. Make necessary assumptions
required
ANS :
Assumptions:
● The system includes Users such as Admins, Students, and possibly Teachers.
● Admins have the ability to create Exams, add Questions, and manage Students.
● Students can register, log in, take Exams, and view their Results.
● Each Exam consists of multiple Questions.
● Questions can be of various types, such as Multiple Choice Questions (MCQ) and
Descriptive Questions.
● Students submit their Answers for the Questions.
● Results are generated based on the Answers submitted by the Students.
[PTO]
2
(b) Draw Deployment Diagram for Online Banking System. Make necessary assumptions
required.
Assumptions:
● Clients (both Web and Mobile) access the system through HTTPS via a
LoadBalancer.
● The LoadBalancer routes incoming requests to the WebServer.
● The WebServer interacts with the Application Server to handle backend logic.
● The Application Server connects to:
3
○ An Authentication Server for user authentication and security.
○ A Database Server for storing data such as accounts and transactions.
○ An External Payment Gateway for processing external payments.
[PTO]
4
5
Q2: (a) Draw State Chart Diagram for Online Re-registration Fee Payment for IGNOU MCA
3 rd Semester. Make necessary assumptions required.
Assumptions:
● The Student logs into the IGNOU portal.
● The Student selects "Re-registration" for the 3rd semester.
● The Student fills in or updates the required details if needed.
● The system verifies the Student’s eligibility (e.g., checks if payment is not already
done and the student is not blocked).
● The Student proceeds to the payment process.
● The payment outcome can be Successful, Failed, or Cancelled.
● If the payment is successful, the re-registration process is completed.
● The states involved in this process are:
○ Start
○ Login
○ Select
○ Re-registration
○ Fill
○ Form
○ Verify Eligibility
○ Payment Processing
○ Payment Successful
○ Payment Failed
○ Re-registration Complete
○ Cancelled
6
7
(b) Draw Sequence Diagram for Online Shopping from an E-commerce Shopping Portal.
Make necessary assumptions required.
Assumptions:
● The Customer browses the shopping portal.
● The Customer searches for products.
● The Customer views the details of products.
● The Customer adds products to the cart.
● The Customer proceeds to checkout.
● The Customer provides shipping details.
● The Customer makes the payment.
● The Order is then confirmed.
● The system sends a confirmation email to the Customer.
● The Actors involved are:
○ Customer
○ Shopping Portal (Frontend)
○ Product Catalog
○ Cart
○ Payment Gateway
○ Order Management System
○ Email Service
[PTO]
8
Q1: Write a program using JSP and JDBC to support editing (address modification, mobile
number/ email id update) of MCA 1st Semester students of IGNOU. The program should
take enrollment number or registered
Assumptions:
● There is a database table named students with the following structure:
CREATE TABLE students (
enrollment_no VARCHAR(20) PRIMARY KEY,
name VARCHAR(100),
address VARCHAR(255),
mobile_no VARCHAR(15),
email_id VARCHAR(100)
);
9
● Students can be filtered either by their enrollment number or by their registered
mobile number.
● A JSP page will be used to edit the student’s address, mobile number, and email ID.
Required Setup:
● Database: MySQL (or similar).
● JDBC Driver: MySQL Connector/J ([Link]) must be
included in your project's lib folder.
● Database Connection Details (dummy example):
○ URL: jdbc:mysql://localhost:3306/ignou
○ User: root
○ Password: password
JSP Program :
<%@ page import="[Link].*" %>
<html>
<head>
<title>Edit MCA 1st Semester Student Details</title>
</head>
<body>
<%
// Database connection variables
String dbURL = "jdbc:mysql://localhost:3306/ignou";
String dbUser = "root";
String dbPass = "password";
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
String message = "";
// Check if form is submitted for search
if ([Link]("search") != null) {
String enrollmentOrMobile = [Link]("enrollmentOrMobile");
10
try {
[Link]("[Link]");
conn = [Link](dbURL, dbUser, dbPass);
String sql = "SELECT * FROM students WHERE enrollment_no = ? OR mobile_no =
?";
ps = [Link](sql);
[Link](1, enrollmentOrMobile);
[Link](2, enrollmentOrMobile);
rs = [Link]();
if ([Link]()) {
%>
<!-- If student found, show form for editing -->
<form method="post">
<input type="hidden" name="enrollment_no" value="<%=
[Link]("enrollment_no") %>">
<p>Name: <%= [Link]("name") %></p>
<p>Address: <input type="text" name="address" value="<%=
[Link]("address") %>"></p>
<p>Mobile No: <input type="text" name="mobile_no" value="<%=
[Link]("mobile_no") %>"></p>
<p>Email ID: <input type="text" name="email_id" value="<%=
[Link]("email_id") %>"></p>
<input type="submit" name="update" value="Update Details">
</form>
<%
} else {
message = "Student not found.";
}
} catch (Exception e) {
[Link]();
message = "Error: " + [Link]();
} finally {
if (rs != null) [Link]();
if (ps != null) [Link]();
if (conn != null) [Link]();
}
}
// Check if update form is submitted
if ([Link]("update") != null) {
String enrollmentNo = [Link]("enrollment_no");
String address = [Link]("address");
String mobileNo = [Link]("mobile_no");
String emailId = [Link]("email_id");
try {
[Link]("[Link]");
11
conn = [Link](dbURL, dbUser, dbPass);
String sql = "UPDATE students SET address = ?, mobile_no = ?, email_id = ?
WHERE enrollment_no = ?";
ps = [Link](sql);
[Link](1, address);
[Link](2, mobileNo);
[Link](3, emailId);
[Link](4, enrollmentNo);
int i = [Link]();
if (i > 0) {
message = "Student details updated successfully.";
} else {
message = "Update failed.";
}
} catch (Exception e) {
[Link]();
message = "Error: " + [Link]();
} finally {
if (ps != null) [Link]();
if (conn != null) [Link]();
}
}
%>
<h2>Search Student</h2>
<form method="post">
<p>Enrollment No or Mobile No: <input type="text" name="enrollmentOrMobile"
required></p>
<input type="submit" name="search" value="Search">
</form>
<h3><%= message %></h3>
</body>
</html>
12
Q2: Write a program to create simple CRUD (Create, Read, Update, and Delete) application
using Spring Boot and Hibernate for Online Registration and Fee Payment for a Workshop
on “Web Technologies” to be organized by an IT Training Organization. Make provisions for
security management in the program. Make necessary assumptions required.
Assumptions:
● The application will allow participants to register for the workshop, make fee
payments, and update or delete their registration if needed.
● Basic security for user authentication and authorization will be implemented (for
example, using Spring Security).
● An H2 database will be used for simplicity, but it can be replaced with MySQL or
PostgreSQL in a production environment.
13
Initialization:
● Create Spring Boot Project: Generate a Spring Boot project using Spring Initializr
with the following dependencies:
○ Spring Web
○ Spring Data JPA
○ Spring Security
○ H2 Database (for this example)
○ Thymeleaf (for HTML templates)
ANS :
1. [Link]
package [Link];
import [Link].*;
import [Link];
@Entity
public class Participant {
@Id
@GeneratedValue(strategy = [Link])
private Long id;
private String fullName;
private String email;
private String mobileNumber;
private Date registrationDate;
private Double feePaid;
// Getters and Setters
public Long getId() {
return id;
}
public void setId(Long id) {
[Link] = id;
}
public String getFullName() {
14
return fullName;
}
public void setFullName(String fullName) {
[Link] = fullName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
[Link] = email;
}
public String getMobileNumber() {
return mobileNumber;
}
public void setMobileNumber(String mobileNumber) {
[Link] = mobileNumber;
}
public Date getRegistrationDate() {
return registrationDate;
}
public void setRegistrationDate(Date registrationDate) {
[Link] = registrationDate;
}
public Double getFeePaid() {
return feePaid;
}
public void setFeePaid(Double feePaid) {
[Link] = feePaid;
}
}
15
2. [Link]
package [Link];
import [Link].*;
import [Link];
@Entity
public class Payment {
@Id
@GeneratedValue(strategy = [Link])
private Long id;
@ManyToOne
@JoinColumn(name = "participant_id")
private Participant participant;
private Double amount;
private Date paymentDate;
private String paymentMode;
// Getters and Setters
public Long getId() {
return id;
}
public void setId(Long id) {
[Link] = id;
}
public Participant getParticipant() {
return participant;
}
public void setParticipant(Participant participant) {
[Link] = participant;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
[Link] = amount;
}
public Date getPaymentDate() {
16
return paymentDate;
}
public void setPaymentDate(Date paymentDate) {
[Link] = paymentDate;
}
public String getPaymentMode() {
return paymentMode;
}
public void setPaymentMode(String paymentMode) {
[Link] = paymentMode;
}
}
3. [Link]
package [Link];
import [Link];
import [Link];
public interface ParticipantRepository extends JpaRepository<Participant, Long> {
Participant findByEmail(String email);
}
4. [Link]
package [Link];
import [Link];
import [Link];
public interface PaymentRepository extends JpaRepository<Payment, Long> {
}
5. [Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
17
import [Link];
@Service
public class ParticipantService {
@Autowired
private ParticipantRepository participantRepository;
public Participant saveParticipant(Participant participant) {
return [Link](participant);
}
public List<Participant> getAllParticipants() {
return [Link]();
}
public Participant getParticipantById(Long id) {
return [Link](id).orElse(null);
}
public void deleteParticipant(Long id) {
[Link](id);
}
public Participant updateParticipant(Long id, Participant participantDetails) {
Participant participant = getParticipantById(id);
if (participant != null) {
[Link]([Link]());
[Link]([Link]());
[Link]([Link]());
[Link]([Link]());
return [Link](participant);
}
return null;
}
}
6. [Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
@Service
18
public class PaymentService {
@Autowired
private PaymentRepository paymentRepository;
public Payment savePayment(Payment payment) {
return [Link](payment);
}
public Payment getPaymentById(Long id) {
return [Link](id).orElse(null);
}
}
7. [Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
@RestController
@RequestMapping("/participants")
public class ParticipantController {
@Autowired
private ParticipantService participantService;
@PostMapping("/register")
public Participant registerParticipant(@RequestBody Participant participant) {
return [Link](participant);
}
@GetMapping("/")
public List<Participant> getAllParticipants() {
return [Link]();
}
@GetMapping("/{id}")
public Participant getParticipantById(@PathVariable Long id) {
return [Link](id);
}
@PutMapping("/{id}")
public Participant updateParticipant(@PathVariable Long id, @RequestBody Participant
participant) {
19
return [Link](id, participant);
}
@DeleteMapping("/{id}")
public void deleteParticipant(@PathVariable Long id) {
[Link](id);
}
}
8. [Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link].*;
@RestController
@RequestMapping("/payments")
public class PaymentController {
@Autowired
private PaymentService paymentService;
@PostMapping("/pay")
public Payment makePayment(@RequestBody Payment payment) {
return [Link](payment);
}
@GetMapping("/{id}")
public Payment getPaymentById(@PathVariable Long id) {
return [Link](id);
}
}
9. [Link]
package [Link];
import [Link];
import [Link];
import [Link];
import
[Link];
20
import
[Link]
apter;
import [Link];
import [Link];
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/participants/register", "/payments/pay").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
10. [Link]
[Link]=jdbc:h2:mem:testdb
[Link]=[Link]
[Link]=sa
[Link]=password
[Link]-platform=[Link].H2Dialect
[Link]=true
[Link]-auto=update
# Security
[Link]=admin
[Link]=admin123
21
Testing
● Use Postman or any REST client.
● Endpoints open without login:
○ POST /participants/register
○ POST /payments/pay
● Other endpoints require:
○ Username: admin
○ Password: admin123