Likes

Core java Ans 2 Assignment

import 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 !!!");
}
}
}

6 comments:

Sanju said...

thanks for the answers sir..
plz upload ans 4 .. of core java assignment ..

Unknown said...

thanks

Unknown said...

GGI+VVG

Unknown said...

can u please tell me that answer is the answer of nemcare health provider in us question or not

Unknown said...

plz send me complete solution on this question my Email id is tafzeel121@gmail.com

Unknown said...

Solving to java question 2.1