Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.prakash.accounttransactionsapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.prakash.accounttransactionsapp.ExistingAccounts"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden|adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AddAccount" />
<activity android:name=".UserTransactions" />
<activity
android:name=".AddTransaction"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".UpdateAccount"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".RecentTransactions"
android:windowSoftInputMode="stateHidden|adjustResize" />
</application>
</manifest>
Pascal:
import java.util.*;
import java.io.*;
public class Pascal_Triangle1 {
public static void main(String[] args) throws Exception {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String height=null, rowid=null,colid=null;
try
{
System.out.println("Read height: " + " ");
height=br.readLine();
int ROW=Integer.parseInt(height);
if(ROW<=7)
{
int[][] pascal = new int[ROW +1][];
pascal[1] = new int[1 + 2];
pascal[1][1] = 1;
for (int i = 2; i <= ROW; i++)
{
pascal[i] = new int[i + 2];
for (int j = 1; j < pascal[i].length - 1; j++)
{
pascal[i][j] = pascal[i-1][j-1] + pascal[i-1][j];
}
}
for (int i = 1; i <= ROW; i++)
{
for (int j = 1; j < pascal[i].length - 1; j++)
{
System.out.print(pascal[i][j] + " ");
}
System.out.println();
}
System.out.print("Read row value :" + " ");
int val1=Integer.parseInt(br.readLine());
System.out.print("Read column value :" + " ");
int val2=Integer.parseInt(br.readLine());
for (int i = 1; i <= ROW; i++)
{
for (int j = 1; j < pascal[i].length - 1; j++)
{
if((i==val1)&&(j==val2))
System.out.print("Requested Value is:" + pascal[i][j] + " ");
}
}
}
if(ROW>=7)
{System.out.println("Must enter row value less than height ");
}
else
{
System.out.println("Must enter row value less than height");
}
}
catch(Exception e)
{
if(height==null)
{
System.out.println("Insufficient parameters.Missing valu for -height");
}
if(rowid==null)
{
System.out.println("Insufficient parameters.Missing valu for -height");
}
if(colid==null)
{
//System.out.println("Must enter col id");
}
if(height==null && rowid==null && colid==null)
{
System.out.println("Must enter height,rowid and colid of triangle");
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.prakash.accounttransactionsapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.prakash.accounttransactionsapp.ExistingAccounts"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden|adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".AddAccount" />
<activity android:name=".UserTransactions" />
<activity
android:name=".AddTransaction"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".UpdateAccount"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".RecentTransactions"
android:windowSoftInputMode="stateHidden|adjustResize" />
</application>
</manifest>
Pascal:
import java.util.*;
import java.io.*;
public class Pascal_Triangle1 {
public static void main(String[] args) throws Exception {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String height=null, rowid=null,colid=null;
try
{
System.out.println("Read height: " + " ");
height=br.readLine();
int ROW=Integer.parseInt(height);
if(ROW<=7)
{
int[][] pascal = new int[ROW +1][];
pascal[1] = new int[1 + 2];
pascal[1][1] = 1;
for (int i = 2; i <= ROW; i++)
{
pascal[i] = new int[i + 2];
for (int j = 1; j < pascal[i].length - 1; j++)
{
pascal[i][j] = pascal[i-1][j-1] + pascal[i-1][j];
}
}
for (int i = 1; i <= ROW; i++)
{
for (int j = 1; j < pascal[i].length - 1; j++)
{
System.out.print(pascal[i][j] + " ");
}
System.out.println();
}
System.out.print("Read row value :" + " ");
int val1=Integer.parseInt(br.readLine());
System.out.print("Read column value :" + " ");
int val2=Integer.parseInt(br.readLine());
for (int i = 1; i <= ROW; i++)
{
for (int j = 1; j < pascal[i].length - 1; j++)
{
if((i==val1)&&(j==val2))
System.out.print("Requested Value is:" + pascal[i][j] + " ");
}
}
}
if(ROW>=7)
{System.out.println("Must enter row value less than height ");
}
else
{
System.out.println("Must enter row value less than height");
}
}
catch(Exception e)
{
if(height==null)
{
System.out.println("Insufficient parameters.Missing valu for -height");
}
if(rowid==null)
{
System.out.println("Insufficient parameters.Missing valu for -height");
}
if(colid==null)
{
//System.out.println("Must enter col id");
}
if(height==null && rowid==null && colid==null)
{
System.out.println("Must enter height,rowid and colid of triangle");
}
}
}
}
import java.util.*;
import java.io.*;
public class Pascal_Triangle2 {
public static void main(String[] args) throws Exception {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String height=null, rowid=null,colid=null;
try
{
System.out.println("Read height: " + " ");
height=br.readLine();
int ROW=Integer.parseInt(height);
int[][] pascal = new int[ROW +1][];
pascal[1] = new int[1 + 2];
pascal[1][1] = 1;
for (int i = 2; i <= ROW; i++)
{
pascal[i] = new int[i + 2];
for (int j = 1; j < pascal[i].length - 1; j++)
{
pascal[i][j] = pascal[i-1][j-1] + pascal[i-1][j];
}
}
for (int i = 1; i <= ROW; i++)
{
for (int j = 1; j < pascal[i].length - 1; j++)
{
System.out.print(pascal[i][j] + " ");
}
System.out.println();
}
System.out.print("Read row value :" + " ");
int val1=Integer.parseInt(br.readLine());
System.out.print("Read column value :" + " ");
int val2=Integer.parseInt(br.readLine());
for (int i = 1; i <= ROW; i++)
{
for (int j = 1; j < pascal[i].length - 1; j++)
{
if((i==val1)&&(j==val2))
System.out.print("Requested Value is:" + pascal[i][j] + " ");
}
}
}
catch(Exception e)
{
if(height==null)
{
System.out.println("Must enter height of triangle");
}
if(rowid==null)
{
System.out.println("Insufficient parameters.Missing value for -row");
}
if(colid==null)
{
System.out.println("Insufficient parameters.Missing value for _col");
}
if(height==null && rowid==null && colid==null)
{
System.out.println("Must enter height,rowid and colid of triangle");
}
}
}
}
No comments:
Post a Comment