MisterCarenioso.findtalk.biz

This is a Free and Open Source Forum that allows student to Copy and Use the Codes Embeded.Please keep This Site Secretly as Much as Possible do not Share This Site to anyone.Thank you By: MisterCarenioso.
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Programming (Slightly Compilcated)

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin


Posts: 67
Join date: 2009-11-24
Age: 20
Location: Philippines

PostSubject: Programming (Slightly Compilcated)   Sat Nov 28, 2009 2:27 am

import java.io.*;
class aa {
public static InputStreamReader reader = new InputStreamReader(System.in);
public static BufferedReader input = new BufferedReader(reader);
public static void main(String args[]) throws Exception {
int row=3, col =3;
int M1[][], M2[][], TM1[][], TM2[][], SUM[][], PRO[][], XADD[][];
String n="";
M1 = new int[row][col];
M2 = new int[row][col];
TM1 = new int[row][col];
TM2 = new int[row][col];
SUM = new int[row][col];
PRO = new int[row][col];
XADD = new int[row][col];
do{
System.out.println();
System.out.println("MATRIX MENU");
System.out.println("1 - Auto-Create/Store matrices elements");
System.out.println("2 - Create/Store matrices elements");
System.out.println("3 - Display matrices elements");
System.out.println("4 - Transpose the matrices elements");
System.out.println("5 - Get the sum of matrix elements");
System.out.println("6 - Get the product of matrix elements");
System.out.println("7 - Check the quality of matrices");
System.out.println("8 - Get the expanded sum matrices");
System.out.println("0 - Exit");
n = input.readLine();
switch(Integer.parseInt(n)){
case 1:
System.out.println("Put your code here for auto-generation of matrix");
break;
case 2:
System.out.println("Enter size of rows : ");
row = Integer.parseInt(input.readLine());
System.out.println("Enter size of columns : ");
col = Integer.parseInt(input.readLine());
M1 = new int[row][col];
M2 = new int[row][col];
XADD = new int [row][col];
//Matrix 1 elements
System.out.println("Enter MATRIX1 elements");
for (int R=0;R<row;R++)
for (int C=0;C<col;C++){
System.out.print("["+R+"]"+"["+C+"]"+"=");
M1[R][C] = Integer.parseInt(input.readLine());
}
//Matrix 2 elements
System.out.println("Enter MATRIX2 elements");
for (int R=0;R<row;R++)
for (int C=0;C<col;C++){
System.out.print("["+R+"]"+"["+C+"]"+"=");
M2[R][C] = Integer.parseInt(input.readLine());
}
break;
case 3:
System.out.println("Matrix M1 elements");
for (int R=0;R<row;R++){
for (int C=0;C<col;C++)
System.out.print(M1[R][C]+" ");
System.out.println();
}
System.out.println("Matrix M2 elements");
for (int R=0;R<row;R++){
for (int C=0;C<col;C++)
System.out.print(M2[R][C]+" ");
System.out.println();
}
break;
case 4:
System.out.println("TRANSPOSE OF MATRICES");
System.out.println("Matrix M1");
System.out.println("Matrix M2");
break;
case 5:
System.out.println();
System.out.println("SUM OF MATRICES M1 AND M2");
System.out.println("M1[][] + M2[][]");
break;
case 6:
System.out.println();
System.out.println("PRODUCT OF MATRICES M1 AND M2");
System.out.println("M1[][] * M2[][]");
break;
case 7:
System.out.println();
System.out.println("EQUALITY OF MATRICES");
System.out.println("M1[][] == M2[][]");
break;
case 8:
System.out.println();
System.out.println("EXPANDED SUM OF MATRICES");
System.out.println("row[][] + col[][]3");
break;
case 0:
n="x";
}
}while(n!="x");
}
}
Back to top Go down
View user profile http://mistercarenioso.findtalk.biz
Admin
Admin


Posts: 67
Join date: 2009-11-24
Age: 20
Location: Philippines

PostSubject: Programming (Boolean)   Sat Nov 28, 2009 2:29 am

import java.io.*;
public class test2{
public static void main(String args[]){
int x=10, y=20, z=5;
boolean i;
i=false;
if(x<y && x<z && y>x && y<z && z>y && z>x){
i=true;
if(i){
System.out.print("The result is true");
}
else{
System.out.print("The result is false");
}
}
}
}
Back to top Go down
View user profile http://mistercarenioso.findtalk.biz
Admin
Admin


Posts: 67
Join date: 2009-11-24
Age: 20
Location: Philippines

PostSubject: Programming (Fibonicci)   Sat Nov 28, 2009 2:33 am

import java.io.*;
class fibonicci {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
int x,w,a = 0;
System.out.print("Enter Constant No. : ");
w = Integer.parseInt(br.readLine());
System.out.println();
int arr[] = new int[w+2];
System.out.println("Enter First Two Integer : " );

for (x = 0; x < 2; x++) {
arr[x] = Integer.parseInt(br.readLine());
System.out.println();}

System.out.println();
for (x = 0; x < 2; x++)
System.out.print(arr[x]+" ");
for (x = 2; x < w+2; x++) {
arr[x] = arr[a] + arr[a+1];
System.out.print(arr[x]+" ");
a++;
}
}
}
Back to top Go down
View user profile http://mistercarenioso.findtalk.biz
Admin
Admin


Posts: 67
Join date: 2009-11-24
Age: 20
Location: Philippines

PostSubject: Programming (Convert)   Sat Nov 28, 2009 2:35 am

import java.io.*;
class aa{
public static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public static void main(String args[])throws IOException{
int x=0;
try{

System.out.println("Menu");
System.out.println("");
System.out.println("Enter 1 for kilometer to miles");
System.out.println("");
System.out.println("Enter 2 for miles to kilometer");
System.out.println("");
System.out.print("==> ");
x=Integer.parseInt(br.readLine());
} catch(NumberFormatException e){
System.out.println("please follow accordingly");

}
switch(x){
case 1: System.out.println("Enter kilometer");

int y=Integer.parseInt(br.readLine());

double s=y*0.6;

System.out.println("");

System.out.println(y+" kilometer is = to "+s+" miles");

break;

case 2: System.out.println("enter miles");
int v=Integer.parseInt(br.readLine());
double b=v/0.6;

System.out.println("");

System.out.println(v+" Miles is = to "+b+" kilometer");

break;
}


}
}
Back to top Go down
View user profile http://mistercarenioso.findtalk.biz
 

Programming (Slightly Compilcated)

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» C++ programming vol:1
» Stanford Computer Programming I, II and II (OCW)
» You've been programming too long when
» DNA as a programming language
» Batch File Programming

Permissions in this forum:You cannot reply to topics in this forum
MisterCarenioso.findtalk.biz :: Your first category :: Your first forum-