Monday 30 November 2015

Java Assignment 1

1.You need to test and debug the application. You need to use the console to input test data and verify the outputs based on the requirement of the system. You also need to validate that the input data conforms to the data format used in the application.

Ans. Grand Park Group is a hospitality company having its head office in Chicago. Grand Park Group is currently in the process of opening its first hotel in the Dallas city. The hotel named Grand Park Regency is a mid-budget hotel with 25 rooms. Grand Park Regency has already hired employees required to operate the hotel and started promotional activities through the print and electronic media. Customers who plan to stay at the hotel will be able to book one or more rooms by visiting the hotel. The hotel receptionist checks for room availability, and after confirmation from the customer, books the room for the specified number of days. At the end of each day, the receptionist generates a report on the room occupancy of the hotel and sends an email attaching the report to the head office. The management of Grand Park Group is aware of the need to automate the operational processes of the hotels to be established. The management wants a system that is modular and can scale with the increase in the volume of operational processes. For this, the management hires Zoom Systems, an IT consultancy firm, to create Hotel Management System (HMS). You are a Java developer at Zoom Systems and have been assigned to work in a team designing and developing HMS. Based on the initial inputs from the management of Grand Park Group, HMS will be released in a phased manner. In the first release, HMS should automate the customer-booking and room-occupancy reporting modules to be used in the Grand Park Regency hotel. Based on the initial requirement gathering, you have analyzed that Grand Park Regency hotel currently has the following categories of rooms:  Standard Room  Executive Room  Family Room In subsequent meetings, you have gathered the requirements of HMS. Initially, HMS will be a standalone application used by the receptionist at the Grand Park Regency hotel. HMS should allow a receptionist to search for the available rooms and book the same for a customer. In addition, HMS should allow a receptionist to generate the room occupancy report of the hotel for each month and store it in the file system as a text file. HMS should also allow the receptionist to daily update the room occupancy report file. A room occupancy report file for a month contains the following pieces of information:  The daily report generation date and time  The total number of rooms occupied under each room category on a day HMS should allow the receptionist to archive the room occupancy report at the end of each month, and create a new report for the next month. You have been assigned the task of analyzing the scenario and leading the team in creating HMS.

Java assignment 4

1. . You need to analyze the object and information structure in the given scenario and perform the following tasks:
 Identify the primary classes and their relationships. The primary classes should model the courses, trainers, and clients.
 Create the primary classes with their required fields and methods.

Ans  import java.util.*;
class Roomctagory
{
int RoomCatagoryId;
varchar Name;
varchar Description;
float Tarrif;
}


class Booking
{
int BookingId;
varchar CustomerName;
varchar CustomerAddress;
varchar CustomerPhone;
Int RoomId;
Timestamp BookingDateTime;
Timestamp CheckinDate;
Timestamp CheckoutDate;
}
class Room
{
int RoomId;
int RoomCatagoryId;
char Status;
}



class MyClass
{
public static void main(String[] args)
{
System.out.println("RoomCatagory, Booking and Room are the three classes.");
}
}

Java assignment 3

1.


Ans    import java.sql.*;
import java.util.*;
class JoinTable
{
public static void main(String[] args) throws SQLException
{
try
{
Class.forName("sun.jdbc.odbc.jdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:Sql","sa","password@123");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select Booking_id , Customer_Name, RoomCatagory_id,Room_id, Checkin_Date, Checkout_Date, Tariff");
while (rs.next())
{
System.outlprintln("\n"+rs.getInt(1)+"\t"+rs.getInt(2)+"\t"+rs.getString(3)+"\t"+rs.getString(4)+
"\t"+rs.getString(5)+"\t"+rs.getString(6)+"\t"+rs.getString(7)+"\t"+rs.getInt(8)+);
}
con.close();
stmt.close();
}
catch(Exception e)
{
}
System.out.println("Records retreived successfully....");
}
}

Java assignment 2


1.


Ansmport java.sql.*;
import java.util.*;
class RoomCatagory
{
public static void main(String args[]) throws SQLException
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:SQL","sa","password@123");
PreparedStatement stmt=con.prepareStatement("insert into RoomCatagory values(?,?,?,?)");
Scanner sc=new Scanner(System.in);
System.out.println("Enter RoomCatagory ID");
int pid=sc.nextInt();
System.out.println("Enter Name ");
String pn=sc.next():
System.out.println("Enter Description");
int did=sc.nextInt();
System.out.println("Enter Tarrif");
String pad=sc.next():


stmt.setInt(C001, Katrina kaif, Delux, 10% );
stmt.setInt(C002, Amir Khan, Super Delux, 5%);
stmt.setInt(C003, Sharukh Khan, Economic, 2%);
stmt.setInt(C004, Deepika Padukone, Premium, 25%);
stmt.executeUpdate();
con.close();
stmt.close();

}
Catch(Exception e)
{
}
System.out.println("Records Inserted Successfully !!!");
}






class Booking
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:SQL","sa","password@123");
PreparedStatement stmt=con.prepareStatement("insert into Booking values(?,?,?,?,?,?,?,?)");
Scanner sc=new Scanner(System.in);
System.out.println("Enter Booking ID");
int pid=sc.nextInt();
System.out.println("Enter Customer Name");
String pn=sc.next();
System.out.println("Enter Customer Address");
int did=sc.nextInt();
System.out.println("Enter Customer Phone");
String pad=sc.next();
System.out.println("Enter Room ID");
String pg=sc.next();
System.out.println("Enter Booking DateTime");
String pg=sc.next();
System.out.println("Enter Checkin Date");
String pg=sc.next();
System.out.println("Enter Checkout Date");
String pg=sc.next():

stmt.setInt(B001, Sandeep, Malviya nagar, 8800225588, R001, 3th March 2015 10:30AM, 8 March 2015, 15 March 2015 );
stmt.setInt(B002, Mohit, Punjabi Bhag, 8800115588, R002, 4th March 2015 10:00AM, 9 March 2015, 16 March 2015 );
stmt.setInt(B003, Perpendicular, Harsh Vihar, 8800225577, R003, 5th March 2015 09:30AM, 10 March 2015, 17 March 2015 );
stmt.setInt((B004, Tangent, Patel Chowk, 8800227788, R004, 7th March 2015 11:00AM, 12 March 2015, 18 March 2015 );

stmt.setSting();
con.close();
stmt.close();

}
Catch(Exception e)
{
}
System.out.println("Records Inserted Successfully !!!");
}
}









class Room
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:SQL","sa","password@123");
PreparedStatement stmt=con.prepareStatement("insert into Room values(?,?)");
Scanner sc=new Scanner(System.in);
System.out.println("Enter Room ID");
int pid=sc.nextInt();
System.out.println("Enter RoomCatagory ID");
String pn=sc.next();
System.out.println("Enter Status ID");
String pn=sc.next();

stmt.setInt(R001, C001, Available);
stmt.setInt(R002, C002, Not Available);
stmt.setInt(R003, C003, Available);
stmt.setInt(R004, C004, Available);
stmt.setSting();
con.close();
stmt.close();
}
Catch(Exception e)
{
}
System.out.println("Records Inserted Successfully !!!");
}
}
}

Software Eng Lab@ 5

1.  Refer to the case study of MerryMeeting Event Organizers. Analyze the existing system and create a design of the proposed system by using the following UML diagrams:
Use case diagram
Class diagram
Sequence diagram (for any use case)
Communication diagram (for any use case)
State diagram (for any object)
 Activity diagram (for any use case)

Ans.  *Use Case Digram:-

A use case is used to:
Represent a list of steps or interactions between a user and a system to fulfill a requirement.
Describe the interactions between the use cases and actors of the proposed software system.
To create the use case diagram for the proposed system, first you need to identify the actors and the use cases.
The following actors will interact with the MerryMeeting system

*Class diagram:-

A class diagram is used:
For visualizing and describing the aspects of a system based on the object-oriented approach.
To describe the attributes, methods, and any constraints for the various classes that can be created for the required system.
To create the class diagram for the proposed system, you need to identify the classes, their attributes and methods, and the relationships between the classes.

*Sequence diagram(for any use case):-

Sequence diagrams represent interactions between objects in the form of messages ordered in a sequence by time.
Let us create a sequence diagram for the Event Inquiry use case.
The following table lists the various classes and their responsibilities in realizing the Event Inquiry use case.

*Communication diagram (for any use case):-

Communication diagrams represent the interaction among objects in the form of messages.

*State diagram (for any object):-

A state machine diagram represents the various states that an object may attain during its life cycle, in response to various events.
In this case, let us create a state machine diagram for the Event object.

* Activity diagram (for any use case):-

An activity diagram depicts the flow of control for a particular process.
ccept Client 


Software Eng Lab@ 4

1.  The design team at Janes Technologies has been assigned a task to create a state chart diagram for the InfoSuper bank ATM system. For this, the team needs to perform the following tasks:
 Identify the states of the ATM.
Identify events responsible for state changes.
Model the flow of control between the states of the ATM. Help the team at Janes Technologies to perform this task.

Ans  To create the state chart diagram for the InfoSuper bank ATM system, you need to perform the following tasks:
1. Identify states.
2. Identify events and transitions.
3. Model the flow of control between the states.
Identifying States
The following states can be attained by an ATM system:
• Reading ATM Card
• Authenticating Customer
o Reading PIN
o Sending to Bank System for Validation
• Accepting Transaction Type
• Accepting Transaction Details
• Sending to Bank System for Approval
• Processing Transaction
• Prompting for Another Transaction
• Handling Invalid PIN
• Dispensing Cash
• Printing Slip
• Ejecting Card
Identifying Events and Transitions
The following events and transitions take place in the state machine diagram:
• When a customer inserts a card into the ATM machine, the state of the machine changes from initial state to Reading ATM Card.
• When a customer inserts a PIN. the state of the machine changes from Reading ATM Card to Reading PIN. which is the sub state of the Authenticating Customer state.
• To authenticate the PIN. the state changes from Reading PIN to Sending to Bank System for Validation. If the customer enters a valid PIN. the state changes to Accepting Transaction Type. Otherwise, it changes to Handling Invalid PIN.
• If the customer enters the PIN maximum number of times, the state changes to Ejecting Card. Otherwise, it changes to Authenticating Customer state.
• After successful authentication of a PIN. the state changes to Accepting Transaction Type.
• When the customer selects the transaction type, such as Cash Withdrawal or PIN change, the state changes to Accepting Transaction Details.
• When the customer enters the transaction details, the state changes to Sending to Bank System for Approval. If the transaction is approved by the Bank System, the state changes to Processing Transaction. Otherwise.it changes to Prompting for Another Transaction.
• Similarly, if the customer selects cash withdrawal as the type of the transaction.the state changes from Processing Transaction to Dispensing Cash. However, if the customer selects to get the transaction summary, the state changes to Printing Slip.
• When the transaction is complete, the state changes to Prompting for Another Transaction.
• If the customer does not wish to continue for another transaction, the state changes from Prompting for Another Transaction to Ejecting Card. However, if the customer wishes to continue, the state changes to Accepting Transaction Type.


2.  The design team at Janes Technologies has been assigned a task to model the flow of activities required to be performed for withdrawing cash from an ATM. For this, the team needs to create an Activity diagram. Help the team at Janes Technologies to create the Activity diagram.


Ans  To create the activity diagram of the cash withdrawal process, you need to perform the following tasks:
1. Identify activities and decisions.
2. Identify partitions.
3. Create an activity diagram.
Identifying Activities and Decisions
A process consists of various activities that you need to identify before you can establish control flow among them. The sequential activities for the cash withdrawal process are:
• Insert Card: Signifies the activity to insert the ATM card in the ATM.
• Enter PIN: Signifies the activity of the bank customer to enter the PIN.
• Accept PIN: Signifies the activity of ATM machine to accept the PIN.
• Validate PIN: Signifies the activity of ATM card to validate the PIN.
• Display Invalid Card Message: Signifies the activity of ATM to display an invalid message, if the PIN entered by the user is incorrect.
• Prompt User Input: Signifies the activity of ATM to prompt the user to initiate a transaction.
• Initiate Withdrawal: Signifies the activity for the bank customer to initiate the cash transaction.
• Prompt User for Withdrawal Amount: Signifies the activity of ATM to prompt the user to enter the amount in the system.
• Enter Amount: Indicates the activity to enter the amount in the system.
• Check Available Balance: Signifies the activity of bank account to check the available balance in the user's account.
• Display Insufficient Balance Message: Signifies the activity of ATM to display a message for insufficient balance to the user.
• Prompt User to Continue: Signifies the activity of ATM to ask the user to continue.
• Collect Cash: Indicates the activity of the bank customer to take the money from the ATM machine.
• Supply Cash: Signifies the activity of ATM to supply cash to the customer.
• Eject Card: Indicates the activity of the bank customer to take the card back from the ATM machine.
The following decisions are made in the process of withdrawing money:
• Validate PIN: Confirms the validation of the PIN entered by the user. If it is invalid, the system prompts the customer to enter another PIN.
• Check Available Balance: Checks the available balance in the account. If the amount withdrawn by the user is greater than the available balance, the system prompts the user to enter an amount less than the available balance.
Identifying Partitions
Partitioning is done to logically group the activity states so that each group represents the responsibility of a particular class. To partition the activity states, you need to create swim lanes for the following classes:
• Bank Customer
• ATM
• ATM Card
• Account

Software Eng Lab@3

1.The design team at Janes Technologies has identified the various classes involved in the ATM withdrawal process. The team now wants to depict the interaction between various objects using a sequence diagram. Help the team to create the sequence diagram.

Ans  To create the activity diagram of the cash withdrawal process, you need to perform the following tasks:
1. Identify activities and decisions.
2. Identify partitions.
3. Create an activity diagram.
Identifying Activities and Decisions
A process consists of various activities that you need to identify before you can establish control flow among them. The sequential activities for the cash withdrawal process are:
• Insert Card: Signifies the activity to insert the ATM card in the ATM.
• Enter PIN: Signifies the activity of the bank customer to enter the PIN.
• Accept PIN: Signifies the activity of ATM machine to accept the PIN.
• Validate PIN: Signifies the activity of ATM card to validate the PIN.
• Display Invalid Card Message: Signifies the activity of ATM to display an invalid message, if the PIN entered by the user is incorrect.
• Prompt User Input: Signifies the activity of ATM to prompt the user to initiate a transaction.
• Initiate Withdrawal: Signifies the activity for the bank customer to initiate the cash transaction.
• Prompt User for Withdrawal Amount: Signifies the activity of ATM to prompt the user to enter the amount in the system.
• Enter Amount: Indicates the activity to enter the amount in the system.
• Check Available Balance: Signifies the activity of bank account to check the available balance in the user's account.
• Display Insufficient Balance Message: Signifies the activity of ATM to display a message for insufficient balance to the user.
• Prompt User to Continue: Signifies the activity of ATM to ask the user to continue.
• Collect Cash: Indicates the activity of the bank customer to take the money from the ATM machine.
• Supply Cash: Signifies the activity of ATM to supply cash to the customer.
• Eject Card: Indicates the activity of the bank customer to take the card back from the ATM machine.
The following decisions are made in the process of withdrawing money:
• Validate PIN: Confirms the validation of the PIN entered by the user. If it is invalid, the system prompts the customer to enter another PIN.
• Check Available Balance: Checks the available balance in the account. If the amount withdrawn by the user is greater than the available balance, the system prompts the user to enter an amount less than the available balance.
Identifying Partitions
Partitioning is done to logically group the activity states so that each group represents the responsibility of a particular class. To partition the activity states, you need to create swim lanes for the following classes:
• Bank Customer
• ATM
• ATM Card
• Account


2. The design team at Janes Technologies has created the sequence diagram for representing the order of the messages in a time sequence. Now, the design team wants to create a UML diagram focusing more on the collaborations of objects than the time sequence. Help team to perform this task.


Ans To create the communication diagram for the cash withdrawal process, you need to perform the following tasks:
1. Identify the collaboration and interactions.
2. Create the communication diagram.
Identifying the Collaboration and Interactions

Class/Actor Responsibilities
Bank Customer Inserts the card. Provides PIN. States the amount to be withdrawn.
ATM Accepts and reads the card information. Prompts the user for input. Accepts PIN from the user. Initiates the validation of PIN. Accepts inputs from the user. Checks the account balance of a customer. Supplies cash to a customer. Initiates the action of balance update. Generates the receipt of any transaction. Ejects the card after the transaction is complete.
ATM Card Validates PIN.
Account Retrieves the balance in the user's account. Updates the balance in the account after a transaction.

Software Eng Lab@ 2

1. The design team at Janes Technologies has created the prototype for the InfoSuper bank ATM system. Now, the InfoSuper bank wants the team to model the static structure of the system. For this, the team needs to derive classes and relationships from the use cases of the ATM machine and create the corresponding class diagram. Help the team at Janes Technologies to perform this task.


Ans. To create the required class diagram, you need to perform the following tasks:
1. Identify the classes with their attributes and methods.
2. Identify the relationships between the classes.
Identifying the Classes with Their Attributes and Methods
The following classes can be created for the ATM system:
• ATM Card: Maintains the details of the ATM card, such as pin and card id. It performs the actions of accepting PIN from the user, validating PIN based on the information stored in the database, and updating PIN on user demand.
• ATM: Maintains the details of the ATM machine, such as its location, bank branch, and available cash. It performs the actions of making a transaction from the ATM, such as accepting the card, reading the card, accepting PIN. withdrawing cash, and printing transaction summary.
• Account: Maintains the details of an account, such as the account number, and balance. It performs the actions of retrieving the account details and checking and updating account balance.
• Current Account: Maintains the details of the current account. Apart from the details mentioned in the Account class, it also includes an additional attribute for maintaining the overdraft limit for the current account.
• Saving Account: Maintains the details of the savings account. Apart from the actions mentioned in the Account class, it also calculates the rate of interest for the savings account type.
• Bank Customer: Maintains the details of the bank customer, such as customer name, phone number, and email address. It performs the actions of retrieving and updating the customer details.
• Address: Maintains the details of the address of the bank customer, such as house number, city, state, country, and zip code. It performs the actions of retrieving and updating the address details.

Identifying the Relationships Between the Classes
The following relationships can exist between the classes of the system:
• Each ATM card is associated with an account. Therefore, the ATM Card class has one-to-one association relationship with the Account class.
• ATM verifies whether an ATM card is valid or not. Therefore, the ATM class has a directed association relationship with the ATM Card class.
• A bank customer uses ATM for money transactions. Therefore, the Bank Customer has a directed association relationship with the ATM class.
• An account can be of the type, current or savings. The accounts have some common as well as different attributes. Therefore, there are two classes. Current Account and Savings Account, which generalize to form the Account class.
• A customer can have multiple bank accounts. In addition, one account can be associated with multiple account holders. Therefore, the Bank Customer class has a many-to-many association relationship with the Account class.
• A bank customer can have one permanent address. Therefore, the Bank Customer class has a one-to-one composition relationship with the Address class.

Software Eng Lab@1

1. The Project Manager at Janes Technologies has created the use case diagram for the InfoSuper bank ATM system. Now, the InfoSuper bank wants Janes Technologies to develop a prototype with few basic functions of the proposed software system before proceeding with the final software development. The functions that the InfoSuper bank wants in the ATM prototype are:
 Allow customers to withdraw cash from the current and savings accounts. 
Allow customers to change their PIN. 
Allow customers to obtain a transaction summary. Moreover, the ATM machine validates the ATM card and PIN of the bank customers before allowing them to use other features. The Project Manager, Jennifer, adopts an iterative approach for the development of the software system. She decides to deliver the prototype after the second iteration of the software development life cycle. In the first iteration, Jennifer plans to implement the required functions only for the savings accounts. In the second iteration, she plans to implement the required functions for the current accounts as well. Help Jennifer to identify the system boundaries and create the use case diagrams for each prototype.


Ans  To create the use case diagram of the ATM system, you need to perform the following tasks:
1. Identify the use cases and actors for the first iteration.
2. Identify the use cases and actors for the second iteration.
Identifying the Use Cases and Actors for the First Iteration
To identify the system boundary for the first iteration, you need to identify the use cases and actors. The use cases for the first iteration are:
• Cash Withdrawal (Savings)
• PIN Change (Savings)
• Transaction Summary (Savings)
The actors for the first iteration are:
• Bank Customer
• Centralized Bank System
In the first iteration, the Cash Withdrawal (Savings). Change PIN (Savings), and Transaction Summary (Savings) use cases can be performed only when the customer is validated by the centralized bank system. Therefore, the Validation use case should be included in the Cash Withdrawal (Savings), Change PIN (Savings), and Transaction Summary (Savings) use cases.
Identifying the Use Cases and Actors for the Second Iteration
In the first iteration, the use case diagram for the savings account is created. Now. in the second iteration, the use cases need to implement the current account function. The basic functions of the corresponding use cases in both the iterations are the same. Therefore, the functions of the use cases of the first iteration can be extended to obtain the use cases of the second iteration.
The following figure depicts the use case diagram that represents how the functions of the use cases of the first iteration can be extended to obtain the use cases of the second iteration.

Asp.net & MVC Lab@15

1.As a part of the software development team, you have been assigned the task of deploying the Web application for GiftGallery on an IIS server. You have decided to test the deployment on the IIS server on your local machine and make any required change before deploying it to the production server.


Prerequisite: To perform this activity, you must be logged on as the Administrator. In addition, to perform this activity, you need to use the GiftGallery.zip file.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbZ3dfQlpGek4wOHc


2.As a part of the software development team, you have been assigned the task of deploying the Web application for GiftGallery on an IIS server by creating a deployment package.

 Prerequisite: To perform this activity,


you must be logged on as the Administrator. In addition, you need to use the GiftGallery.zip file.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbWnhEZkNCcWtNUms

Asp.net & MVC Lab@15

1.You have developed the Web application for GiftGallery store. Currently the application is not secure as anybody can add, edit and delete gift items in the application. Now, you have been assigned a task to restrict the access to the Web pages, so that only authenticated users are able to add, edit, and delete gift items. However, any user can view the gift details page and all the other pages in the Web application without being authenticated. To implement the preceding requirement, you have decided to use Forms authentication. In addition, a user should also be allowed to log on to the Web application by using his/ her Google account credentials. Help your teammates to implement the preceding requirement.


 Prerequisite: Ask your faculty to provide you the required starter files for this exercise.


Ans.    https://drive.google.com/open?id=0B-yL1mP3zqTbUFVqQmlmUWxCM0E

2.You have implemented the functionality on the GiftGallery store Web application so that only the authenticated users are able to view the interface for adding, editing, and deleting the gift items. However, these authenticated users can belong to any role. Now, you have been assigned a task to implement security in the Web application that it allows only the users having an administrator role to add, edit, and delete the gift items details. In addition, only authenticated users should be able to access the Feedback page. Help your teammates to implement the preceding requirement.


Prerequisite: Ask your faculty to provide you the required starter files for this exercise.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbSVMwWmlfdnlPaUE

Asp.net & MVC Lab@14

1.You have developed the GiftGallery application and created the Web pages, such as Home, Contact Us, and Gifts. Your project manager has appreciated your creativity. However, he has observed that the response time of the Web application is high. He has asked you to enhance the performance of the Web application. For this, you have decided to use caching. You want to cache the content of the Home, Feedback, and Contact Us pages. Moreover, you have observed that a substantial amount of time is consumed while retrieving the gift details on the Gifts page. Therefore, you have decided to cache the gifts details by using data cache. Further, the Home, Contact Us, Feedback, and Gifts pages should display the date and time when the page was last updated.

Prerequisite: Ask your faculty to provide you the required starter files.


Ans    https://drive.google.com/open?id=0B-yL1mP3zqTbckRBNGtmcmV2NW8


2.After looking at the website of GiftGallery store, your supervisor suggests you to provide a better experience to the users who visit the website. For this, he suggests you to allow the users to personalize the look and feel of the website. When a user visits the website, it should display the Change Theme link, as shown in the following figure.
The Home Page The Change Theme link should redirect a user to the Change Theme page. The Change Theme page should allow a user to select a theme by using a drop-down list, as shown in the following figure.



The Change Theme Page Depending on the theme, the look and feel of the website should change. When a user selects a theme, the selected theme should be applied to all the Web pages on the website. Moreover, when the user revisits the website by using the same computer, the personalized look and feel should be retained on all the Web pages.



Prerequisite: Ask your faculty to provide you the required starter files.

Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbZ2puZXJnUFpDb1E

Saturday 28 November 2015

Asp.net & MVC Lab@13

1.

Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbeW1fam05WGlOR0U


2.You have implemented the functionality on the Home page of the GiftGallery store website that allows a user to view the gifts corresponding to the gift category selected by him/her by using an accordion. The accordion displays dynamic content retrieved from a database and consumes a lot of time to generate. To resolve this problem, you have decided to implement donut hole caching on the Home page. Further, the Home page should display the date and time when the accordion was last updated.

Help your team to implement this requirement. Prerequisite: Ask your faculty to provide you the required starter files.


Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbd3lIQWlaU1lYdTg




Asp.net & MVC Lab@12

1.

Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbZUtCNmxFbXlaQm8

2. As the Web Developer at GlobalIT, you have developed a Web application for the GiftGallery store. The Web application lists the gift items on the Gifts page. In addition, it allows a user to find the gift items available in a particular category and within a specific price range. However, when a user clicks the Filter Gifts button, the entire page is posted to the Web server, which causes unnecessary traffic on the network. Now, your team has been assigned a task to modify the Gifts page so that only the required information is sent to the server to reduce the network traffic. Help your teammates to accomplish the preceding task.



Prerequisite: Ask your faculty to provide you the required starter files for this exercise.

Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbTjRoeWhHZE9vclE

3.

Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbM1BoWG5CVXA2d1E


Asp.net & MVC Lab@11

1.



Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbbF93WHJDNHJrak0


2. As the Web Developer at GlobalIT, you have developed a Web application for the GiftGallery store. The Web application lists the gift items on the Gifts page. Now, you have been assigned a task to modify the Home page so that a user can easily select a gift item under a particular category, as shown in the following figure.

The Home Page When a user selects any gift, its details should be displayed to the user. Now, you need to help your teammates to accomplish the preceding task.


 Prerequisite: Ask your faculty to provide you the required starter files for this exercise.


Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbaFdWeUd3SENmTVE

Asp.net & MVC Lab@10

Asp.net&MVC Lab@ 9

Asp.net & MVC Lab@8

1.



The Confirm Delete Page Once a user clicks the Delete button, the Gifts page is displayed. To implement the preceding functionality, you have created a model named Gift. Now, you need to help your teammates to accomplish the preceding task. Prerequisite: Ask your faculty to provide you the required starter files for this exercise.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbNVp5cVU3aTFUeWc



2.  As a member of the development team at GlobalIT, you have developed a Web application for the GiftGallery store. The application allows the administrator of GiftGallery to add, edit, and delete gift items. At present, the application allows the user to add the details of a gift items in simple text box fields. Now, the team decides to update the existing model to implement the following functionalities in the application: Enable the user to select a category of gift item from an existing list, such as Greeting Cards, Toys, Electronic Toys, Perfumes, Watches, Clothes, and Photo Frames, which is retrieved from a table named GiftCategory.


Now, you need to help your teammates to accomplish the preceding task.

 Prerequisite: Ask your faculty to provide you the required starter files for this exercise.


Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbWHZqR29CZ2ZDM28

Asp.net & MVC Labs@7

1.
The GiftGallery store is committed to providing gifts of diverse categories to its customers. It fulfills the needs of customers of all ages from all sections of the society. To increase the sales of gifts, the management is planning to use the GiftGallery application for selling gifts online. For this, the management shares its requirement with GlobalIT, a software development company. You are the Web Developer at GlobalIT. You have been asked to add the functionality in the GiftGallery application, so that the administrator can add details of all the gifts in the application, as shown in the following figure.


The Add Gift Page In addition, you need to create the Gifts List page, which can be used to view the details of all the added gift items, as shown in the following figure. The Gifts List Page


 Prerequisite: Ask your faculty to provide you the required starter files for this exercise.



Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbVnZEVXBtTGI3Ulk




Asp.net & MVC Lab@6

Asp.net & MVC Lab@5

1. As per the requirements of the GiftGallery store, Joe has instructed his team members to create the Offers Web page and show the available discount offers on it. You need to help the team in creating the Offers Web page, as shown in the following figure.

The Offers Page Fo
r this, you need to create an action method within the Home controller that passes the available discount offers to the corresponding view. In addition, you need to add footer on each Web page, as shown in the following figure.


 The Offers Page Instead of making the change in each individual view, you decide to create a partial view to render the content of the footer. Prerequisite: Ask your faculty to provide you the required starter files for this exercise.



Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbdTBKX2MtalVWaEU



2.The GiftGallery store is committed to providing gifts of diverse categories to its customers. It fulfills the needs of customers of all ages from all sections of the society. To increase the sales of gifts, the management is planning to use the GiftGallery application for selling gifts online. For this, the management shares its requirement with GlobalIT, a software development company. You are the Web Developer at GlobalIT. You have been asked to add the functionality in the GiftGallery application, so that the administrator can add details of all the gifts in the application, as shown in the following figure.


 The Add Gift Page In addition, you need to create the Gifts List page, which can be used to view the details of all the added gift items, as shown in the following figure. The Gifts List Page

Prerequisite: Ask your faculty to provide you the required starter files for this exercise.





Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbU2I5MUZSanFfbDg


Friday 27 November 2015

Asp.net & Mvc Lab@4

1.Explore the following features of ASP.NET MVC:
 Routing
 Scaffolding
 Configuration-over-Configuration

Ans https://drive.google.com/open?id=0B-yL1mP3zqTbM0JlRFBMU2NxV0U


2.


Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbTHRwUHVDZGpwM3c



3.Create a new MVC project in Visual Studio. Explore the following folders in the Solution Explorer window and identify their purpose:
App_Data
 App_Start
 Content Scripts
 Global.asax
Web.config


Ans https://drive.google.com/open?id=0B-yL1mP3zqTbUTJxWTJKV3oyaGM



Asp.net & Mvc lab@3

1.Write a detailed note on the MVC technology, its various components, and ASP.NET implementation.


Ans                                                                  MVC
The MVC model is an alternetive to the ASP.NET Web form model for devoping web  application it is a light-wight model and suport existing ASP.NET feature. It separateds the following three main companents. It separates the following three main componets from an application:

Model: Refer to a set of classes that describes the data that the application works with. In addition, these classes define the bussines logic that governs how the login form that contains text boxes boxes an buttons.

View: Refers to the components that define an application user interface. for example, the login from that contain text boxes and buttons.

Controller: Refres to a set of classes that handle commnication from the user and the overall application flow . A controller responds to user input, communicates with the model, and decides the view to render. By seprading model, View, and controller within an application , the MVC model ensure loose compling. Therefore, it enables you to focuse on one aspect of the implementaion at a time. Foe eample, you can concentrate on designing a view without worrying about thebussiness logic.

The MVC model makes it easier to manage complexcity by dividing an application into the model, the view, an the controller. Therefore, it should be used for developing web application that are managed by larges tearms of devlopers and web designer.

                                                   The Asp.net Impementaion of MVC

In MVC, incoming request are handled by controllers. Controllers are C# that contain methods. Each public method in a controller is known as an action method can be invoked by using a URL. when an HTTP request is sent to the server by using a URL is executed in order to perform the requried opration on a model. Than a view is rendered and display to the clint. The following figure displys the interation between the controller, the model, and the view.


2.
Ans
https://drive.google.com/open?id=0B-yL1mP3zqTbQXVVUjlKQWFobk

Asp.net & MVC Lab@2

1. Explain the benefits of ASP.NET MVC.


Ans  The ASP.NET MVC is an open source web application framework that implements the model–view–controller (MVC) pattern.
Based on ASP.NET, ASP.NET MVC allows software developers to build a web application as a composition of three roles: Model, View and Controller. The MVC model defines web applications with 3 logic layers:

Model (business layer)
View (display layer)
Controller (input control)
A model represents the state of a particular aspect of the application.
A controller handles interactions and updates the model to reflect a change in state of the application, and then passes information to the view.
A view accepts necessary information from the controller and renders a user interface to display that information.



ASP.NET MVC framework is a lightweight, highly testable presentation framework that is integrated with existing ASP.NET features.
Some of these integrated features are master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.
The ASP.NET MVC Framework couples the models, views, and controllers using interface-based contracts, thereby allowing each component to be tested independently.
The view engines used in the ASP.NET MVC 3 and MVC 4 Frameworks are the Razor View Engine and the Web Forms view engine. Both view engines are part of the MVC 3 framework. By default, the view engine in the MVC framework uses Razor .cshtml and .vbhtml, or Web Forms .aspx


Asp.net & MVC Lab@ 1

1. 


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbdzBJOUpwbllPUUk


2.• • • Explore the following Web application development models:
Web forms
 MVC
Web pages


Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbUGhpS0UxMmwxdHc


Thursday 26 November 2015

Java Lab@15

1.Take the existing Employee DAO Memory application and refactor thecode to use JDBC instead. The solution from the "Exceptions and Assertions" lesson has beenrenamed to EmployeeDAOJDBC. You will need to create an EmployeeDAOJDBCImpl class toreplace the EmployeeDAOMemoryImpl class, and modify the EmployeeDAOFactory toreturn an instance of your new implementation class instead of the Memory version.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbeTBBZC1GOXhaZ0U


2.Take the existing Employee DAO Memory application and refactor thecode to use JDBC instead. The solution from the "Exceptions and Assertions" lesson has beenrenamed to EmployeeDAOJDBC. You will need to create an EmployeeDAOJDBCImpl class toreplace the EmployeeDAOMemoryImpl class, and modify the EmployeeDAOFactory toreturn an instance of your new implementation class instead of the Memory version.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbSnFnSUtBM1F5ZVk



3.Peter needs to create an application that will enable the staff of City Library to update the details of the publishers according to their ID. For this, the application should allow the staff member to select the field and update its value. Help Peter to achieve the preceding requirement. Prerequisite: To perform this exercise, you need to ensure that the Publisher table with appropriate values exists in the Library database. If the database and the table with appropriate values do not exist, you need to create the Library database, and then execute scripts in the Create_Publisher.txt and Insert_Publisher.txt files.


Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbV192dXBmRmw5M3M




Java Lab@14

1.Add code to an existing application. You must determine whether the code is run in a multithreaded environment, and, if so, make it thread-safe.

Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbREthdFpVelpMb0k


2. Create a new project and start a new thread.


Ans package com.crunchify;

public class CrunchifyThread {

/**
* @author Crunchify.com
*/

public static void main(String args[]) {
new ThreadTest("eBay").start();
new ThreadTest("Paypal").start();
new ThreadTest("Google").start();
}
}

class ThreadTest extends Thread {
public ThreadTest(String str) {
super(str);
}

public void run() {
for (int i = 0; i < 5; i++) {
System.out.println("Loop " + i + ": " + getName());
try {
sleep((int) (Math.random() * 2000));
} catch (InterruptedException e) {
}
}
System.out.println("Test Finished for: " + getName());
}
}


3. Write a Java program to simulate the table tennis game. The game should be played in a synchronized manner by two players. When the two players are ready, an appropriate message should be displayed. When the game starts, the output should be displayed in the following format: Player 1 ready...
Player 2 ready...
 Ping--> <--Pong


Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbWjhzbml3RVVHMHc


4. Write a Java program that creates three threads. All three threads should get executed simultaneously and should display the values between 0 and 6. Moreover, you need to ensure that the main thread must be terminated when the execution of the all other threads gets completed. In addition, the output should be displayed in the following format: Thread created: Thread[ChildThread,3,main] Thread created: Thread[ChildThread,7,main] Thread created: Thread[ChildThread,8,main] Main thread waiting for child thread to finish Thread[ChildThread,3,main]loop :1 Thread[ChildThread,7,main]loop :1 Thread[ChildThread,8,main]loop :1 Thread[ChildThread,8,main]loop :2 Thread[ChildThread,7,main]loop :2 Thread[ChildThread,3,main]loop :2 Thread[ChildThread,7,main]loop :3 Thread[ChildThread,3,main]loop :3 Thread[ChildThread,8,main]loop :3 Thread[ChildThread,3,main]loop :4 Thread[ChildThread,7,main]loop :4 Thread[ChildThread,8,main]loop :4 Thread[ChildThread,7,main]loop :5 Thread[ChildThread,3,main]loop :5 Thread[ChildThread,8,main]loop :5 Thread[ChildThread,3,]is alive ? : false Thread[ChildThread,7,]is alive ? : false Thread[ChildThread,8,]is alive ? : false Main Thread is exiting


Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbdnRBd3hCMWVTaWs

Java Lab@13

1. Use the Files.readAllLines method to read the entire contents oftwo files: a form template, and a list of names to send form letters to. After creating a form letterwith a name from the name list, you will use the Files.write method to create the customletter. You will also use the Pattern and Matcher classes that you saw in the "StringProcessing" lesson.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbRE9Kd0pVaXdaMU0


2.  Write Java classes that use the FileVisitor class to recursively copy onedirectory to another.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbVi1mMVZRMUdIWVk


3.  Write a Java main that creates a PathMatcher class and usesFileVisitor to recursively delete a file or directory pattern.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbVUxXcm5oQjRMa3M

Java Lab@12

1.   Use the java.io.ObjectOutputStream class to write a Java object to the file system (serialize), and then use the same stream to read the file back into an object reference. You will also customize the serialization and deserialization of the ShoppingCart object


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbdEZWVHNqakt1Vjg



2.  Write a program to create a bank application that provides the basic functionalities to operate the savings account.
The application should provide the following functionalities:
A menu should be displayed that will allow the user to open a new account, deposit money, withdraw money, check balance, and exit.
If the open a new account option is selected, the program should prompt the user to enter the basic details, such as name, contact number, address, and opening amount. Further, it must generate an account number and allocate that number to the new account. In addition, the user details along with the account number must be saved in the Saving_Account.txt file; and a separate file for the new account with the account number as the name of the file must be created.
If the deposit money, withdraw money, or check balance option is selected, the program should ask for the account number from the user. Thereafter, it should validate the account number, and on the basis of the valid account number, it should execute the following functionalities: Deposit money option:
 The program should ask the user to enter the deposit amount. In addition, it should update the transaction and the balance in the respective file of the account holder. Withdraw money option: The program should ask the user to enter the amount to withdraw. In addition, it should update the transaction and the balance in the respective file of the account holder. Check balance: It should display the current balance. If the exit option is selected, the application must terminate.

Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbWmQ3dElLbzNVZWs


3. Write a Java program to perform the following tasks:
 Reading a text file
Writing in a text file
Searching in a text file


Ans   1. Create a Java application. Chapter10_Exercise03.
2. Create a class. FileOperation. in the Java application. Chapter10_Exercise03.
3. Replace the existing code in the FileOperation.java file with the following code:

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Scanner;
public class FileOperation {
public void readFile() {
Scanner sc = new Scanner(System.in);
String fileName;
System.out.print("Enter the text file name that you want to read from the D:\\ drive: "); fileName = sc.nextLine();
try (BufferedReader br = new BufferedReader(new FileReader("D:\\" + fileName + ".txt "))) {
String s;
System.out.println("\nThe " + fileName + " contains the following text:\n");
System.out.println
while ((s = br.readLine()) != null) {
System.out.println(s);
}
} catch (Exception e) {
System.out.println("File does not exists."); menu();
}
}
public void writeFile() {
Scanner sc = new Scanner(System.in);
String fileName, text;
System.out.print("Enter the file name from the D:\\ drive in which you 'want to write: "); fileName = sc.nextLine ();
System.out.print("Enter the text you want to write in the " + fileName + " file: "); text = sc.nextLine();
try {
FileWriter fos = new FileWriter("D:\\" + fileName + ".txt", true);
BufferedWriter bw = new BufferedWriter(fos); bw.newLine(); bw.write(text);
bw.close (); fos.close();
System.out.println("\nThe text has been added in the file");
} catch (Exception e) {
System.out.println("File does not exists"); menu();
}
}
public void searchFileO {
Scanner sc = new Scanner(System.in);
String fileName, text; int counter = 0, flag = 0;
System.out.print("Enter the file name from the D:\\ drive in which you want to search: ");
fileName = sc.nextLine();
System.out.print("Enter the string you want to search in the " + fileName + " file: "); text = sc.nextLine();
try (BufferedReader br = new BufferedReader(new FileReader("D:\\" + fileName + ".txt "))) {
String s;
while ((s = br.readLine()) != null) {
String splitData() = s.split(" ");
{
for (int i = 0; i < splitData.length; i++) if (splitData(i].equals(text)) {
if (splitData(i].equals(text)) {
counter++; flag = 1;
}
}
} catch (Exception e) {
System.out.println("File does not exits"); menu () ;
}
if (flag == 1) (
if (counter == 1) {
System.out.println("\"" + text + "\" has occured " + counter + " time");
} else {
System.out.println("\"" + text + "\" has occured " + counter + " times");
}
} else {
System.out.println("The entered word doest not exist in the file.");
}

public void menu() { int option;
Scanner sc = new Scanner(System.in);
System, out. print In (" \n-----Menu---------") ;
System.out.println("1. Reading");
System.out.println("2. Writing");
System.out.println("3. Searching");
System.out.println("4. Exit");
System.out.print("\nChoose the option: ")
option = sc.nextInt();
switch (option) { case 1:
readFile(); menu(); break; case 2:
writeFile(); menu(); break; case 3:
searchFile();
menu(); break; case 4:
System.exit(0); break; default:
System.out.println("Incorrect menu option");
menu(); break;
}
}
public static void main(String!) args) {
FileOperation fo = new FileOperation() fo.menu();
}
}



Java Lab@11

1.

1.
2.
3.
 • • • • • • • • • • • • • • • • • • • • James is employed as a Software Developer at AxisPro Technologies. He has been assigned the task to create the Fill in the Blanks game for kids. The menu of the game should provide the following options: Play Instructions Quit Thereafter, James needs to implement the following functionalities: On selecting the Play option: Enter details: The player needs to enter his/ her name to start the game. Select Category: A list of categories, such as countries, fruits, and animals, should be displayed to the player. From the listed categories, the user needs to enter the name of the category from which he/ she wants to get the words. Guess alphabet: After selecting the category, a word from the respective category should be picked and the blanks for that word should be displayed, such as for TIGER, it should display _ _ _ _ _. The player will have to correctly guess an alphabet for each of the blanks. After guessing the correct word, the congratulation message should be displayed. In addition, blanks for the next word should be displayed till the list gets finished. If the player guesses the alphabet incorrectly, that alphabet must be added in the list of missed words. The player is allowed only the length of the word/2 incorrect guess. Calculate Score: Score, such as 10 or 20, should be given to the player on guessing a correct word. An appropriate message with the score should be displayed when the player guesses all the words correctly and when the game gets over. Scores with the name of the player in the Score.txt file must be stored or updated. Create Files: Create a Master.txt file that will contain the list of categories. Create a separate file for each category, such as for animals, create Animal.txt, and for fruits, create Fruit.txt. On selecting the Instructions option, the instructions of the game should be displayed. On selecting the Quit option, the game must terminate. Help James to implement the preceding functionalities.


Ans   https://drive.google.com/open?id=0B-yL1mP3zqTbVmxMTWRUV0dTM0k


Java Lab@10

1.Write a program to accept two numbers and perform division. In addition, the program should provide the functionality such that if a user tries to divide the number by 0, the program should terminate with a customized message.

Ans  import java . util . Scanner;

public class Divison {

 public static void main (String args []) {
 
  int num1, num2, result;
  Scanner input = new Scanner (System . in);
  System.out.println ("Enter the 1st number");
  num1 = input . nextInt ();

 System.out.println ("Enter the 2nd number");

 num2 = input . nextInt ();

 try {

   result = num1 / num2;
   System.out.println ("The result is " + result);

 } catch (ArithmeticException e) {

 System,out.println ("Divison by zero not Possible! ");
  }

 }

}

2. Write a simple console-based application that reads from and writes to the system console. In NetBeans, the console is opened as a window in the IDE.

Ans    https://drive.google.com/open?id=0B-yL1mP3zqTbU0F3enpLM3ctYkE


3. • • • • Write a program to create a class to handle the enquiry details related to tourism. The class should provide the following functionalities: A menu should be displayed that allows the user to initiate enquiry, view enquiry, and exit the menu. If the option to initiate enquiry is selected, the program should allow the user to enter the enquiry details, such as name, contact number, address, enquiry category, and description of the enquiry. In addition, the enquiry categories will be Prices, Locations, and Packages. Further, the entered details should be stored in the Enquiry.txt file. If the option to view query details is selected, the name of the user, whose details need to be viewed, should be entered. If the name exists in the Enquiry.txt file, the details should be displayed. Otherwise, an error message should be displayed. If the option to exit the menu is selected, the program must terminate.

Ans   import java . io . BufferReader;
import java  . io . BufferReader;
import java . io . FileReader;
import java . io . FileWriter;
import java . io . Scanner;

public class EnquiryForm
{

String enquiryrDetails [] = new String [5];

public void showMenu () {
int option;
Scanner sc = new Scanner (System . in);

System.out.println ("\n-----------Menu-----------");
System.out.println ("1. Initiate Enqiury");
System.out.println ("2. View Enquiry");
System.out.println ("3. Exit");
System.out.println ("\nChoose the option: ");

 option = sc . nextInt ();

 switch (option) {
    case 1:
       intEnq ();
       showMenu ();
       break;
    case 2:
        viewEnq ();
        showMenu ();
        break;
    case 3:
         exitMenu ();
         break;
      default:
        System.out.println ("Incorrect menu option");
          showMenu ();
          break;
      }
   }

 public void initEnq () {
 
  char choice = 'y';

 do {
      Scanner sc = new Scanner (System . in(;
      System.out.println ("Enter Name: ");
      enquiryDetails [0] = sc . nextLine () . to LowerCase () + ",";
 
      System.out.print ("Enter Contact No: ");
      enquiryDetails [1] = sc . nextLine () + ",";
      System.out,print ("Enter Address: () + ",";
      System.out.print ("Enter Enquiry Category
   (Prices/Local/Packages) : ");
     enquiryDetails [3] = sc . nextLine () + ",";
    System.out.print ("Enter Enquiry Description: ");
     enquiryDetails [4] = sc . nextLine () + ",";

      try {
          FileWriter fos = new FileWriter
   ("Enquiry . txt ", true);
               BufferedWWriter bw = new BufferedWriter
    (fos);
            for (int i = 0; i < enquiryDetails . length
    i++) {

             bw . write (enquiryDetails [i]);
         }
           bw . newLine ();
           bw . close ();
          fos . close ();
      } catch (Exception e) {
        System.out.println (e);
      }
      System.out.print ("\nDo you want to initiate more enquiry: ");
      String ch = sc . next () . toLowerCase ();
       choice = ch . charAt (0);
    } while (choice == 'y');
 }
    public void viewEnq () {
   Scanner sc = new Scanner (System . in);
   String name;
   int flag = 0;
   System.out.print("Enter the name of the user to view the details: ");
    name = sc . nextLine () . toLowerCase ();
   try (BufferedReader br = new BufferedReader(new
FileReader("Enquiry.txt ")))    {
            String s;
            while ((s = br.readLine())  != null)   {
               String plitData[] = s.split(",");
             if (splitData[O].equals(name))    {
                 System.out.println("Enquiry Detail:");
                 System.out.println
("=================================")
                  System.out.println("Name:
 " + splitData[O] );
                  System.out.println("contact No:
" + splitData[1] );
                  System.out.println("Address:
" + splitData[2] );
                  System.out.println("Enquiry Catagory:
" + splitData[3] );
                   System.out.println ("Enquiry Description: " + splitData [4]);
               System.out.println
 ("===================================");
           flag = 1;
        }
    }
      if (flag == 0) {
       System.out.println (name + " does not exists");
      }
    } catch (Exception e) {
    }

    public void wxitMenu () {

     System.exit (0);
}
   public static void main (String [] args) {
    EnqiuryForm obj = new EnquiryForm ();
    obj . showMenu ();
}

}



Java Lab@9

1.1. 2. 3. • • • • • David has been assigned a task of creating an application to store the employee details. For this, David decides to display the following menu when the application starts: Enter Data Display Data Exit Thereafter, he decides to implement the following functionalities: When a user selects the option to enter data, the employee details, such as employee ID, employee name, department, designation, date of joining, date of birth, marital status, and date of marriage, should be captured. However, the date of marriage can be captured only if the employee is married. In addition, a functionality to add more records should be implemented. When a user selects the option to display the data, the stored data must be displayed. When a user selects the option to exit, the application must be terminated. Further, David needs to implement user-defined exceptions for the following cases: If the menu input entered by the user is other than 1, 2, or 3, an appropriate message should be displayed to the user and the application must restart. If the employee ID does not start with the alphabet, e or E, an appropriate message should be displayed to the user and the application must terminate. Help David to implement the preceding functionalities.

Ans    https://drive.google.com/open?id=0B-yL1mP3zqTbTkR6cXp0dHZTVU0

2.Create a new project and catch checked and unchecked exceptions.

Ans    https://drive.google.com/open?id=0B-yL1mP3zqTbX3NTNFVqaEZ2TWs

3.Take an existing application and refactor the code to make use of a custom exception class and a custom auto-closeable resource.

Ans.     https://drive.google.com/open?id=0B-yL1mP3zqTbaXhGRTI5OVdBRlk

4.• • • • Create a calculator application in Java that will accept two numbers. In addition, the calculator application should allow a user to perform any of the following operations at a time on the two given numbers: Addition Subtraction Multiplication Division Further, you need to implement assertions to assert that both the numbers should be greater than 0.

Ans     https://drive.google.com/open?id=0B-yL1mP3zqTbU3g0Q1AtdlV5aVk

5.You need to write a program to register the member details to get an entry ticket of a disco. The program should accept the member details, such as name, contact number, and age. In addition, the program must throw an exception with an appropriate message if the age is not within the range of 18 to 55.

Ans  https://drive.google.com/open?id=0B-yL1mP3zqTbUW5IRnpRNWhfb1E