shereen
help to write a program for biology to know if two person are related or not
1 Answer(s)      4 years and 2 months ago
Posted in : Java Beginners

I wrote the program and i want some help pleas this program check between if they are related or not . i have no problem of reading file and inserted in 2d array but i have wrote program to sum the ones each rows and compared to the second matrix and so that about coulmns , note : two matrix are not equal ! ,, so i will compared the small one with the bigger one so that i use start point and end point , i need only help to write the two method which sum rows and coulmns,

4

**0 0 0 0

1 1 1 1

1 1 0 0

1 1 1 1**

6

0 1 1 1 1 0

0 0 0 0 0 0

1 1 1 1 1 0

1 1 1 0 0 0

1 1 1 1 1 1

1 1 1 1 1 1

my work is

public static void main(String[] args)
{

    try
    {
        Scanner sc = new Scanner(new File("zoo"));
        int caseOne = sc.nextInt();
        int count=0 ;
        while(caseOne>=count)
        {
            //read the first matrix size.
            int length1=sc.nextInt();
            int sum=0;
            System.out.println(length1);
            int[][] m1 = new int[length1][length1];
            // print array in rectangular form
            for (int r=0; r<m1.length; r++)
            {
                for (int c=0; c<m1[r].length; c++)
                {
                    m1[r][c]=sc.nextInt();
                    System.out.print(" " + m1[r][c]);
                }
                System.out.println("");
            }
    // case two
          int length2=sc.nextInt();
            System.out.println(length2);
            int[][] m2 = new int[length2][length2];
            // print array in rectangular form
            for (int r=0; r<m2.length; r++)
            {
                for (int c=0; c<m2[r].length; c++)
                {

                    m2[r][c]=sc.nextInt();
                    {
                    System.out.print(" " + m2[r][c]);
                    }


                }
             for (int a=0; a<m2.length; a++)
            {
                for (int c=0; c<m2[a].length; c++)
                {
                    int startPoint= m2[r][c]-m1[r][c]/2;
                    System.out.print(" " + startPoint);
                    int EndPoint= m2[r][c]-startPoint;
                    System.out.print(" " + EndPoint);
                }
                System.out.println("");

            }

    count++;
        }

    }
    }
    catch (Exception e)
    {
            System.out.println(e);
    }
}


            public static int sumRow( int[][] m1,int startPoint,int ei, int A[])
            {

                return A[i];
            }
            public static int sumcol(int m2[][],int si,int ei, int B[])
            {
                int i=0 ;
                return B[i];

            }

}

Advertisement
View Answers

March 18, 2011 at 3:21 PM


sorry for my weak english










Related Tutorials/Questions & Answers:
help to write a program for biology to know if two person are related or not
help to write a program for biology to know if two person are related or not   I wrote the program and i want some help pleas this program check... point and end point , i need only help to write the two method which sum rows
Help me to write this simple java frame program
Help me to write this simple java frame program   I want to write a Java program for.... To create a frame with 4 text fields;name,street,city and pin;with suitable labels. Also add a button "OK". After enter values
Advertisements
write a program which asks the user for two int values and calculates their sum.
write a program which asks the user for two int values and calculates their sum.  The title says it all, an example is (1,2) > 3
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Write a C language program to read two matrices and multiply them?
Write a C language program to read two matrices and multiply them?  Write a C language program to read two matrices and multiply them?   Here is an example of multiplying two matrices using C language. #include <
write a program that Implement an integrated COM client server to add two numbers.by visuall studio 2010
write a program that Implement an integrated COM client server to add two numbers.by visuall studio 2010  write a program that Implement an integrated COM client server to add two numbers.by visuall studio 2010 if someone can do
Write a program to list all even numbers between two numbers
Write a program to list all even numbers between two numbers... Numbers Example in Java: Here you will learn to write a program for listing out all the even numbers between two numbers. For this first create a class named
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx  Write a program that will print out a hydro bill. The bill will be formatted as the example on the next page. The following information
plz help me out with this problem...please write the program for me.thanxxxxx
plz help me out with this problem...please write the program for me.thanxxxxx  Write a program that will print out a hydro bill. The bill will be formatted as the example on the next page. The following information
really need help on how to write this program plz some 1 help out. - Java Beginners
really need help on how to write this program plz some 1 help out.  i am confused here on what to write can some 1 help out here i dont quite understand how to code it so can some 1 help out. Part II Write, compile and execute
write a program
write a program  write a program add 2 no.s without use arithmetic,unary operaters in java
help in java program
help in java program  please could you help me with my assignment I have to submit it on Monday 29 October please help me :( Write a program to test the Person class defined below. Your test program should
jsp program related
jsp program related  how to run jsp program   How to run jsp program: Follow these steps: 1)Go to the Control Panel>>System>>... url: http://localhost:8080/examples/hello.jsp and press enter. 9)You jsp program
Help with this program
Help with this program  Write a program that would do the following: 1) Read two Strings from the user 2) The user should input two integer numbers... the .intValue() method. 4) Add the two integers. 5) Output the result Do the same fir when
Write a program in java...
Write a program in java...  Hi, friends Please, can you help me? Q1: Write a program in java to simulate a calculator. Your program should take two... to enter an integer number. Write a program in java to find the factorial
Help with this program
Help with this program  Write a program that would do the following: 1) Read a String from the user. The String will be the following: "My grade is x" (where x is an integer between 0-9) 2) Get the String to integer by creating
PLEASE Help me write a Java program which will store, manipulate, and print student registration information.
PLEASE Help me write a Java program which will store, manipulate, and print student registration information.  HERES TEH QUESTION - I AM MISSING SOME..., ADDRESS AND ADMISSIONS CLASS PLEASE HELP!!! Write a Java program which
How to implement a superclass Person? - Java Beginners
Person. Make two classes, Student and Lecturer, that inherit from Person. A person has a name and year of birth. A student has a degree program and a lecturer..., write a program name TestQ2 that instantiates an object of each
help to write java code
help to write java code  write a full code to produce a system will calculate all items to get total carry-marks which are 60 marks. and get sum of assignment 1,assignment 2, midterms-test and lave work to get total marks
help to write java code
help to write java code  write a full code to produce a system will calculate all items to get total carry-marks which are 60 marks. and get sum of assignment 1,assignment 2, midterms-test and lave work to get total marks
How to implement this superclass Person - Java Beginners
a superclass Person which it need to Make two classes, Student and Instructor, that inherit...,birthYear=1969],salary=65000.0]''); } } i don't know how to write a coding based on two parameters at the constructor...help me please..  Hi Friend
write a java program
write a java program  write a program to print '*' in a circular form
how to write this program
or numerical grade. You will be submitting TWO versions of this program. Write one...how to write this program  Write a program in java which calculates...?Ęs GPA. This program should take a student√Ę‚?¨‚?Ęs First Name, Last Name a GPA
How to write Java Program
How to write Java Program  how to write a program to find average of 5 student marks
WRITE A PROGRAM IN JAVA
WRITE A PROGRAM IN JAVA  Write program which accepts five students id,name,age,department,courses, taken and its grade. a. calculate its GPA . display all student information in ascending order
Write java program?
Write java program?  1 11 121 1331 14641 15101051
write the java program?
write the java program?  1 11 121 1331 14641 15101051
write the java program?
write the java program?  1 11 121 1331 14641 15101051
Write java program?
Write java program?  1 11 121 1331 14641 15101051
Write a java application program........?
Write a java application program........?  Welcome every One : I have Q in Java? Q : Write a java application program that reads 20 integer numbers input by the user and prints how many numbers > 100 and how many numbers