Nov
03
Click to download File Handling in C++ Sample code dated 03.11.2018
For BCA Students
Do corrections in header files as per C++ Dev Turbo C++ editor
Nov
03
Do corrections in header files as per C++ Dev Turbo C++ editor
Jun
11
Mar
28
Feb
12
CUI Menu Based Java Program Sample
//—————–T45.java———————-
import java.io.*;
class T45{
public static void main(String args[]){
Console c=System.console();
int mn;
String ch;
do{
System.out.println(“\t\t :: Main Menu ::”);
System.out.println(“1- Get the Area of Square”);
System.out.println(“2- Get the Area of Rectangle”);
mn=Integer.parseInt(c.readLine(“Enter Your choice: “));
switch(mn){
case 1: {
//System.out.println(“case 1 executed”);
Square obj=new Square();
obj.area();
break;
}
case 2:{
//System.out.println(“case 2 executed”);
Rect obj=new Rect();
obj.area();
break;
}
default: System.out.println(“Invalid Choice”);
}
ch=c.readLine(“Do you want to continue(y/n): “);
}while(ch.equalsIgnoreCase(“y”));
}
}
//—————–Square.java———————-
import java.io.*;
class Square{
int a, area;
Console c=System.console();
void area(){
a=Integer.parseInt(c.readLine(“Enter length of square: “));
area=a*a;
System.out.println(“SQ Area is: “+area);
}
}
//—————–Rect.java———————-
import java.io.*;
class Rect{
int n1,n2, area;
Console c=System.console();
void area(){
n1=Integer.parseInt(c.readLine(“Enter width of rect: “));
n2=Integer.parseInt(c.readLine(“Enter height of rect: “));
area=n1*n2;
System.out.println(“Rect Area is: “+area);
}
}
Dec
04
NOTES OF BCA-V Subject: Java Programming and Dynamic Webpage Design (BCA-S302T)
Nov
17
import java.sql.*;
import java.io.*;
class TestDb9{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
Statement stmt=con.createStatement();
//——————— TO DELETE RECORED——–
Console c=System.console();
String empno=c.readLine(“Enter Emp No want to update: “);
String mob=c.readLine(“Enter Mobile Number:”);
String qu=”update emp set mobile='”+mob+”‘ where empno=”+empno;
System.out.println(qu);
int num=stmt.executeUpdate(qu);
if(num==0){
System.out.println(“No such record found”);
}
// ———————— END —————————-
qu=”select * from emp order by empno”;
ResultSet rs=stmt.executeQuery(qu);
while(rs.next()){
System.out.println(rs.getString(“empno”)+”\t”+rs.getString(“ename”).toUpperCase()+”\t”+rs.getString(“mobile”));
}
rs.close();
stmt.close();
con.close();
}catch(Exception e){
System.out.println(e);
}
}
}
Nov
17
import java.sql.*;
import java.io.*;
class TestDb8{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
//——————— TO DELETE RECORED——–
Console c=System.console();
String empno=c.readLine(“Enter Emp No want to delete: “);
String qu=”delete from emp where empno=”+empno;
System.out.println(qu);
int num=stmt.executeUpdate(qu);
if(num==0){
System.out.println(“No such record found”);
}
// ———————— END —————————-
qu=”select * from emp order by empno”;
ResultSet rs=stmt.executeQuery(qu);
while(rs.next()){
System.out.println(rs.getString(“empno”)+”\t”+rs.getString(“ename”).toUpperCase()+”\t”+rs.getString(“mobile”));
}
rs.close();
stmt.close();
con.close();
}catch(Exception e){
System.out.println(e);
}
}
}
Nov
17
import java.sql.*;
import java.io.*;
class TestDb6{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
//——————— TO INSERT RECORED——–
Console c=System.console();
String empno=c.readLine(“Enter Emp No: “);
String empName=c.readLine(“Enter Emp Name: “);
String empMob=c.readLine(“Enter Emp Mobile: “);
String qu=”insert into emp values(“+empno+”,'”+empName+”‘,'”+empMob+”‘)”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“row inserted”);
// ———————— END —————————-
qu=”select * from emp order by empno”;
ResultSet rs=stmt.executeQuery(qu);
while(rs.next()){
System.out.println(rs.getString(“empno”)+”\t”+rs.getString(“ename”).toUpperCase()+”\t”+rs.getString(“mobile”));
}
rs.close();
stmt.close();
con.close();
}catch(Exception e){
System.out.println(e);
}
}
}
Nov
17
import java.sql.*;
import java.io.*;
class TestDb5{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
String qu=”select * from emp”;
ResultSet rs=stmt.executeQuery(qu);
while(rs.next()){
System.out.println(rs.getString(“empno”)+”\t”+rs.getString(“ename”).toUpperCase()+”\t”+rs.getString(“mobile”));
}
}catch(Exception e){
System.out.println(e);
}
}
}