Thursday, November 1, 2007

Now in C# also...

Hi Friends,
Not only in Java if you need simple sample programs in C#..post here your requirements... we are ready to help you in C# also...

18 comments:

Anonymous said...

hi im a new aspirant of java its really interesting to see such a site,i will surely ask doubts to uu

PRAVINTH G said...

Yes. you are welcome!

Anonymous said...

Hi- I just found your site, kind of by accident, but I am trying to write a program in Java that will be able to save multiple forms that are filled out, then give the information back in a printable form.

Here is what I have written:

// Demonstrating the JLabel class.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Pottery extends JFrame {
private JLabel label1,label2,label3,label4,label5,label6,label7,label8,label9,label10,label11,label12,label13,label14,label15,label16,label17,label18,label19,label20,label21,label22;
private JButton button1;
private ButtonGroup gbutton;
private JTextField text,text1,text2,text3,text4,text5;
private JComboBox Combo1,Combo2,Combo3,Combo4,Combo5,Combo6,Combo7,Combo8,Combo9,Combo10,Combo11;

String[] combo = {"1", "2", "3", "4", "5", "6"};
String[] combo1 = {"Shropshire", "Cornwall", "SW France", "East Anglia"};
String[] combo2 = {"9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00"};
String[] combo3 = {"Smoking", "Non-Smoking"};
String[] combo4 = {"Adult", "Child", "Disabled"};
String[] combo5 = {"Economy", "First Class"};
String[] combo6 = {"Beginner", "Intermediate", "Advanced"};
String[] combo7 = {"Mr", "Mrs", "Miss"};
String[] combo8 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"};
String[] combo9 = {"January", "Februrary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};


public Pottery()
{
super( "Airline Booking Form" );

Container c = getContentPane();
c.setLayout( new FlowLayout(FlowLayout.CENTER, 30,30));
// JLabel constructor with a string argument
label1 = new JLabel( "Airline Booking Form" );
label1.setToolTipText( "Airline Booking Form" );
c.add( label1 );


//LABEL

label2 = new JLabel( "Customer Information" );
c.add( label2 );

label3 = new JLabel( "Title" );
c.add( label3 );

//COMBOBOX

Combo8 = new JComboBox(combo7);
Combo8.setToolTipText("This is a Combo Box");
c.add(Combo8);

label4 = new JLabel( "First Name" );
c.add( label4 );

//TEXTBOX

text = new JTextField (10);
c.add(text);

label5 = new JLabel( "Surname" );
c.add( label5 );

text1 = new JTextField (10);
c.add(text1);

label6 = new JLabel( "Address 1" );
c.add( label6 );

text2= new JTextField (10);
c.add(text2);

label7= new JLabel( "Address 2" );
c.add( label7 );

text3 = new JTextField (10);
c.add(text3);

label8 = new JLabel( "City" );
c.add( label8 );

text4 = new JTextField (10);
c.add(text4);

label9 = new JLabel( "Postcode" );
c.add( label9 );

text5 = new JTextField (8);
c.add(text5);

label10 = new JLabel( "Ticket Information" );
c.add( label10 );

label11 = new JLabel( "Departure Date" );
c.add( label11 );

label12 = new JLabel( "Day" );
c.add( label12 );

Combo9 = new JComboBox(combo8);
Combo9.setToolTipText("This is a Combo Box");
c.add(Combo9);

label13 = new JLabel( "Month" );
c.add( label13 );

Combo10 = new JComboBox(combo9);
Combo10.setToolTipText("This is a Combo Box");
c.add(Combo10);

label14 = new JLabel( "Return Date" );
c.add( label14 );

label15 = new JLabel( "Day" );
c.add( label15 );

Combo9 = new JComboBox(combo8);
Combo9.setToolTipText("This is a Combo Box");
c.add(Combo9);

label13 = new JLabel( "Month" );
c.add( label13 );

Combo10 = new JComboBox(combo9);
Combo10.setToolTipText("This is a Combo Box");
c.add(Combo10);

label18 = new JLabel( "Number of Tickets" );
c.add( label18 );

Combo1 = new JComboBox(combo);
Combo1.setToolTipText("This is a Combo Box");
c.add(Combo1);

label19 = new JLabel( "Destination" );
c.add( label19 );

Combo2 = new JComboBox(combo1);
Combo2.setToolTipText("This is a Combo Box");
c.add(Combo2);

label20 = new JLabel( "Passenger Type" );
c.add( label20 );

Combo5 = new JComboBox(combo4);
Combo5.setToolTipText("This is a Combo Box");
c.add(Combo5);

label21 = new JLabel( "Ticket Type" );
c.add( label21 );

Combo6 = new JComboBox(combo5);
Combo6.setToolTipText("This is a Combo Box");
c.add(Combo6);

label17 = new JLabel( "Seat Preference" );
c.add( label17 );

Combo4 = new JComboBox(combo3);
Combo4.setToolTipText("This is a Combo Box");
c.add(Combo4);

label22 = new JLabel( "Pottery Package Type" );
c.add( label22 );

Combo7 = new JComboBox(combo6);
Combo7.setToolTipText("This is a Combo Box");
c.add(Combo7);

//BUTTON

button1 = new JButton("Save");
c.add(button1);



setSize( 500, 600 );
setVisible(true);


}

public static void main( String args[] )
{
Pottery app = new Pottery();

app.addWindowListener(
new WindowAdapter() {
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
}
);
}
}

I am also looking for a method that will add the time to what is saved.

If you could help me out on this, I would really appreciate it.

Anonymous said...

I don't understant what the troubles do you have? Try to use common packages in JVM for get current time (System) in long formate, then convert it by Gregoria calendar or date format to string and print it everewhere.
But it does not matter. Look this
it is the best site for dating with Russian women
Try to find your love.

Anonymous said...

Hi can u plz tell me how to stimulate a calculator(simple)through a Java program.It's urgent & i m not getting it.If u don mind can u send ur reply to sangeetamathur68@yahoo.com.If u don mind.
Thanks

Anonymous said...

Email me your userId so i can send you the calculator program i wroted for you

Suleman Zia said...

Sangeeta please check your email. I sent you the calculator program.

Anonymous said...

I need an urgent answer please.

Here`s the question..
Java using arrays

Write a program to input a possibly integer n(n<=10); followed by n real values into an arrya a of size n and the program must perform the following:

Display back the values input
Sort the values and display them
Display the max value
Calculate and display the average.

kajri said...

hi my self KAJRI


WILL U PL. HELP TO WRITE A RPOGRAM
IN C & C++ USING POINTER
WITH A SIMPLE DEEMO PROG PL. LET ME KNOW THE "POINTER"

PRAVINTH G said...

Hi KAJRI,
Sure we can help you.
If you want to learn pointers then you can find lot of samples in net, but if you want some specific sample then we can write that one for you (if we have time).

kajri said...

HI DEAR PRAVINTH
PL WRITE A PROG. FOR ME AS FOLLOWS

MATRIX [ ARRAY] ADDITION,SUBSTRACTION,.........
DIAGONAL ADDITIOND BY USING ARRAY & POINTER....IN C & C++


REGARDS
KAJRI

PRAVINTH G said...

/*Hi Kajiri,
Here is the C Matrix multiplication, Its using pointers with dynamic memory allocation with minimal call to malloc.*/
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

#define FOR(a,b) for(a=0;a<b;a++)
#define p(a) printf(a)

int Mul(const int **MatA,const int **MatB,int row,int col,int r2)
{
int n;
int sum=0;
FOR(n,r2)
sum+=*(*(MatA+row)+n) * *(*(MatB+n)+col);
return sum;
}
void printM(const int **matrix,int row,int col)
{ int r,c;
FOR(r,row)
{
FOR(c,col)
printf("%d\t",*(*(matrix+r)+c));
printf("\n");
}
return;
}

int main()
{
int col1,row1,col2,row2,row,r,c,sum;
int **matrixA,**matrixB,**matrixC, *tptr,*tptrB,*tptrC;

p("Enter the no. of rows and columns of MatrixA: ");
scanf("%d %d",&row1,&col1);
tptr = malloc(row1 * col1 * sizeof(int));
matrixA = malloc(row1 * sizeof(int *));
FOR(row,row1)
*(matrixA + row) = tptr + col1 * row;

p("Enter the elements of MatrixA: ");
FOR(r,row1)
FOR(c,col1)
scanf("%d",*(matrixA+r)+c);

p("Enter the no. of rows and columns of MatrixB: ");
scanf("%d %d",&row2,&col2);
if(col1!=row2)
{
p("Matrix multiplication cant be processed. \n The no. of columns of MatrixA is not equivalent to no. of rows of MatrixB.");
return 0;
}

tptrB = malloc(row2 * col2 * sizeof(int));
matrixB = malloc(row2 * sizeof(int *));
FOR(row,row2)
*(matrixB + row) = tptrB + col2 * row;

p("Enter the elements of MatrixB: ");
FOR(r,row2)
FOR(c,col2)
scanf("%d",*(matrixB+r)+c);

p("Elements of MatrixA:\n");
printM(matrixA,row1,col1);

p("Elements of MatrixB:\n");
printM(matrixB,row2,col2);

tptrC = malloc(row1 * col2 * sizeof(int));
matrixC = malloc(row1 * sizeof(int *));
FOR(row,row1)
*(matrixC + row) = tptrC + col2 * row;
FOR(r,row1)
FOR(c,col2)
*(*(matrixC+r)+c)=Mul(matrixA,matrixB,r,c,row2);

p("Multipled Matrix:\n");
printM(matrixC,row1,col2);

getch();
return 0;
}
/* It takes time to develope other matrix programs. if you want more programs mail us.
*/

car freak said...

i am vinoth i want a java program based on bank account like deposit, withdrawal,interest rate add by 1 dollars for every 4 withdrawals

car freak said...

if i have ur email id i can send questions to u

PRAVINTH G said...

Hi CarFreak(Vinoth),
am not understanding this, "interest rate add by 1 dollars for every 4 withdrawals"
please provide more clear info.
If you expect some project kind of thing and not any simple programs, then please post your e-mail id here.

kajri said...

CAN U TELL ME TO WRITE CODE FOR VB

IN SIMPLE
1. ADDITION
2. SUBSTRACTION
.......

AND OFCOURSE THNK YOU FOR THE PROGRAM.........

kajri said...

PL WRITE VB CODE FOR ME
FOR DOING ADDITION, SUBSTACTION....



REGARDS

PRAVINTH G said...

Hi kajiri,post u a reply when i get time.. now am busy have lot of work to finish...