Questionable Assignment...

Public Matrix add(Matrix theM){
//implement the method such that it adds an object of matrix of the same size to
//m
//returns the result as an object of Matrix.
I dont know what that means...
* Write a description of class Matrix here.
* Kenneth Waters
* Lab05
* 3/20/2005
import java.io.*;
import java.util.*;
public class Matrix
    private double[][] m;
    private int rowN;
    private int colN;
    public Matrix(double[][] aM)
        rowN = aM.length;
        colN = aM[0].length;
        m = new double[rowN][colN];
        m = aM;
    public Matrix(String filePathName, int rows, int cols)
        int row = 0;
        m = new double[rows][cols];
        try
          Scanner s1 = new Scanner (new File(filePathName));
            while (s1.hasNextLine())
                int col = 0;
                String input = s1.nextLine();
                StringTokenizer tokenizer = new StringTokenizer( input );
            while( tokenizer.hasMoreTokens() )
                String value = tokenizer.nextToken();
                double parseValue = Double.parseDouble(value);
                m[row][col] = parseValue;
                col++;
            row++;
            catch(FileNotFoundException e)
           e.printStackTrace();
    public void display()
        for (int row = 0; row < m.length; row++ )
            for (int column = 0; column < m[ row ].length; column++)
            System.out.printf( "%.2f ", m[row][column] );
            System.out.println();
    public int getRowNumber(){
        return rowN;
    public int getColNumber(){
        return colN;
    public double getElement(int row, int col){
        return m[row][col];
    public double[] getRow(int row){
        return m[row];
    public double[] getCol(int col)
        double[] res  = new double[ rowN ];
        for(int i = 0; i < rowN; i++)
            res[i] = m[i][col];
            return res;
    public double getMax(){
        double largest = 0.0;
        for (int row = 0; row < m.length; row++ )
            for (int column = 0; column < m[ row ].length; column++)
            if( m[row][column] > largest ){
                largest = m[row][column];
        return largest;
    public double getRowSum(int rowNumber){
        double sum = 0.0;
        for(int c = 0; c < colN; c++)
            sum = sum + m[rowNumber][c];
            return sum;
    public double[] getRowSums(){
            double[] sums = new double[colN];
            for(int r=0; r < rowN; r++)
                sums[r] = getRowSum(r);
            return sums;
    public double getColSum(int colNumber)
        double sum = 0.0;
        double[] res  = new double[ colN ];
        for(int i = 0; i < rowN; i++)
            res[i] = m[i][colNumber];
            sum += res;
return sum;
public double[] getColSums()
double[] sums = new double[rowN];
for (int i = 0; i < colN; i++)
sums[i] = getColSum(i);
return sums;
public Matrix multiply(double aNumber){
double[][] s = new double[rowN][colN];
for(int r = 0; r < rowN; r++)
for(int c = 0; c < colN; c++)
s[r][c] = aNumber*m[r][c];
return new Matrix(s);
public Matrix add(Matrix theM){
That method is one of the last i have to implement. I left it open at the end so you know wher ein the code it is. I dont expect anyone to do it, just help me determine what im doing exactly, lol. Thanks

* Write a description of class Matrix here.
* Kenneth Waters
* Lab05
* 3/20/2005
import java.io.*;
import java.util.*;
public class Matrix
    private double[][] m;
    private int rowN;
    private int colN;
    public Matrix(double[][] aM)
        rowN = aM.length;
        colN = aM[0].length;
        m = new double[rowN][colN];
        m = aM;
    public Matrix(String filePathName, int rows, int cols)
        int row = 0;
        m = new double[rows][cols];
        try
          Scanner s1 = new Scanner (new File(filePathName));
            while (s1.hasNextLine())
                int col = 0;
                String input = s1.nextLine();
                StringTokenizer tokenizer = new StringTokenizer( input );
            while( tokenizer.hasMoreTokens() )
                String value = tokenizer.nextToken();
                double parseValue = Double.parseDouble(value);
                m[row][col] = parseValue;
                col++;
            row++;
            catch(FileNotFoundException e)
           e.printStackTrace();
    public void display()
        for (int row = 0; row < m.length; row++ )
            for (int column = 0; column < m[ row ].length; column++)
            System.out.printf( "%.2f ", m[row][column] );
            System.out.println();
    public int getRowNumber(){
        return rowN;
    public int getColNumber(){
        return colN;
    public double getElement(int row, int col){
        return m[row][col];
    public double[] getRow(int row){
        System.out.println(m[row]);
        return m[row];
    public double[] getCol(int col)
        double[] res  = new double[ rowN ];
        for(int i = 0; i < rowN; i++)
            res[i] = m[i][col];
            System.out.println(res);
            return res;
    public double getMax(){
        double largest = 0.0;
        for (int row = 0; row < m.length; row++ )
            for (int column = 0; column < m[ row ].length; column++)
            if( m[row][column] > largest ){
                largest = m[row][column];
        return largest;
    public double getRowSum(int rowNumber){
        double sum = 0.0;
        for(int c = 0; c < colN; c++)
            sum = sum + m[rowNumber][c];
            return sum;
    public double[] getRowSums(){
            double[] sums = new double[colN];
            for(int r=0; r < rowN; r++)
                sums[r] = getRowSum(r);
            return sums;
    public double getColSum(int colNumber)
        double sum = 0.0;
        double[] res  = new double[ colN ];
        for(int i = 0; i < rowN; i++)
            res[i] = m[i][colNumber];
            sum += res;
return sum;
public double[] getColSums()
double[] sums = new double[rowN];
for (int i = 0; i < colN; i++)
sums[i] = getColSum(i);
return sums;
public Matrix multiply(double aNumber){
double[][] s = new double[rowN][colN];
for(int r = 0; r < rowN; r++)
for(int c = 0; c < colN; c++)
s[r][c] = aNumber*m[r][c];
return new Matrix(s);
public Matrix add(Matrix theM){
Matrix result = new Matrix(m);
for (int row = 0; row < m.length; row++ )
for (int column = 0; column < m[ row ].length; column++)
result.m[row][column] = m[row][column] + theM.m[row][column];
return result;
public Matrix multiply(Matrix theM){
Matrix result = new Matrix(m);
for (int row = 0; row < m.length; row++ )
for (int column = 0; column < m[ row ].length; column++)
result.m[row][column] = m[row][column] * theM.m[row][column];
return result;
* Write a description of class TestMatrix here.
* @author (your name)
* @version (a version number or a date)
public class TestMatrix
    public static void main(String[] s)
        double[][] a = { {2.0,3.25,4.1},{0,1.75,5.2}};
        double[][] a1 = { {2.9,4.1,6.8},{10.12345,0.55,-5}};
        Matrix m = new Matrix(a);
        Matrix m1 = new Matrix(a1);
        System.out.println("The matrix m is ");
        m.display();    //display method tested
        System.out.println("The first row is ");
        m.getRow(0);    //displayRow method tested
        System.out.println("The first column is ");
        m.getCol(0);    //displayCol method tested
  //test getElement, getRowNumber, and getColNumber methods
        double store = m.getElement(m.getRowNumber()-1,m.getColNumber()-1);
        System.out.println("The last element is "+store);
  //test getRowSum and getRowSums methods
        System.out.println("The row sums are");
        for (int r=0; r < m.getRowNumber(); r++)
            System.out.println(""+(m.getRowSums())[r]); //calling getRowSums method
            //or System.out.println(""+m.getRowSum(r)); by calling getRowSum method
       //test add method
  System.out.println("the sum of ");
        m.display();
        System.out.println("and ");
        m1.display();
        System.out.println("is ");
        (m.add(m1)).display();
        //test multiply method
  System.out.println("the product of ");
        m.display();
        System.out.println("and ");
        m1.display();
        System.out.println("is ");
        (m.multiply(m1)).display();
        //add other codes to test each of the rest methods

Similar Messages

  • BPEL Question : assign one xsd:unbounded to other xsd:unbounded

    Hi, i have a problem executing a bpel which maybe im procesing bad.
    I am invoking some web services:
    response of webservice #1 returns a list of elements. (xsd:)
    request of webservice #2 receives a list with some elements from the response above (ws #1).
    [JPG helps to understand that process.|http://img230.imageshack.us/img230/6471/img1pa0.jpg]
    is there somenthing im missing when I try to assign one xsd:unbounded to other xsd:unbounded?
    runtime appserver stacktrace in the bpel process.
    BPCOR-6129:Line Number is 77
    BPCOR-6130:Activity Name is Assign_DatosGeneradorReporte
           at com.sun.jbi.engine.bpel.core.bpel.engine.impl.BPELInterpreter.createVirtualFaultUnit(BPELInterpreter.java:250)
           at com.sun.jbi.engine.bpel.core.bpel.engine.impl.BPELInterpreter.execute(BPELInterpreter.java:202)
           ... 7 more
    Caused by: com.sun.xml.transform.sware.TooManyElementsException: Too many elements: {null}cedula
           at com.sun.xml.transform.sware.impl.DOMSorter.addToSortedList(DOMSorter.java:509)
           at com.sun.xml.transform.sware.impl.DOMSorter.sort(DOMSorter.java:296)
           at com.sun.xml.transform.sware.impl.DOMSorter.sort(DOMSorter.java:413)
            ....Thanks!

    I have figured out that with xpath and copy-of operation I can copy all nodes that come in place of xsd:any from one schema to other .But beofre copying I want to change the attribute values of the node that come in place of xsd:any based on the mapping stored in the DVM.Request some one to please help .

  • Question:  Assignment Time Information API for OTL

    Is there any api that we can call to load Assignment Time Information into OTL?

    is this the api?
    HXT_GEN_AAI.Create_Otlr_Add_Assign_Info

  • Multiple Chart Types Question

    I have a chart with 4 data series.  The 1st 3 are column and the 4th is line.  The line is removed on the 4th series to show up as a data point.
         The data point for the 4th series shows up as in the middle of the 3 other series so it looks like the data point is related to the 2nd series.  I'm curious what controls this behavior?  Any way to shift it so it appears over the 1st series?
    Thanks!

    Closing Question
    Assigning Points

  • E-Recruiting question status

    Hello,
    I'm having problems getting my questions to change status in e-recruiting. I am using a separate frontend/backend system with a standalone scenario. I followed
    http://wiki.scn.sap.com/wiki/display/ERPHCM/Questionnaire+cannot+be+saved+in+%27released%27+status
    I activated BAdi HRHAP00_FOLLOW_UP_SE and added it in OOHAP_BASIC and then in PHAP_CATALOG I selected the enhancement. I then re-implemented SAP Note 1301016 but I still have the same problem. In SLG1 I keep getting the same error as before. When I save in status released it says "Data was saved successfully" but the question remains in status "Draft."  In the webdynpro for questionnaires it creates a 2 new templates titled "New Template for Questionnaires" in status draft (both for internal and external use) with the question assigned to it.
    In SLG1 I have the following errors:
    The error occurred in program CL_HRRCF_QA_QUESTION==========CM00M line 48
    Column FPER does not exist
    The error occurred in program CL_HRRCF_QA_ELEMENT===========CM00E line 78
    Does anyone have any idea what could be the problem?

    Fixed the problem - in OOHAP_BASIC I added columns MAND and FPER manually and then in PHAP_CATALOG in Evaluable Information in tab columns I selected the 2 columns. No more errors, and the questions and questionnaires can be released.

  • Questions about a MasterQuize program

    Hi, everyone.
    I got a in-class case study program like this in the class:
    * This class stores/represents a question that has one of two
    * answers: True or False.
    * <p></p>
    * It needs to track the following information:
    * <ul>
    * <li>Question text</li>
    * <li>Correct answer</li>
    * <li>The user's answer to the question</li>
    * <li>Points value</li>
    * <li>Category</li>
    * <li>Difficulty rating</li>
    * </ul>
    // Our question should allow us to do the following:
    // - Create question (constructor) -- may be overloaded
    // - Print (display) question
    // - Check client's answer for correctness
    // - Get points value for question (0 or max)
    //   - Add "No-BS" grading option
    // - Getting client's answer
    // - Check to see if answered by client
    public class TrueFalseQuestion
        // Class constants (to simplify changes to common values)
        public static final int MIN_DIFFICULTY_LEVEL = 1;
        public static final int MAX_DIFFICULTY_LEVEL = 5;
        public static final int DEFAULT_DIFFICULTY_LEVEL = 1;
        public static final int DEFAULT_POINT_VALUE = 1;
        public static final String DEFAULT_CATEGORY_VALUE = "none";
        // Class instance variables
        private String questionText;
        private String correctAnswer;
        private String userAnswer;
        private int pointsValue;
        private String category;
        private int difficultyLevel; // TODO: Set a range for difficulty levels
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param pts The total points available for this question
         * @param ctgry Category keyword for this question
         * @param level The perceived/intended difficulty level of this question
         * <p></p>
         * Defines a TrueFalseQuestion object.
        public TrueFalseQuestion (String text, String answer, int pts, String ctgry, int level)
            // Set starting values for all instance variables
            questionText = text.trim();
            correctAnswer = answer.trim();
            userAnswer = null; // No user answer supplied yet
            if (pts >= 1) // We assume that every problem is worth at least 1 point
                pointsValue = pts;
            else
                pointsValue = DEFAULT_POINT_VALUE;
            category = ctgry.trim();
            if (level >= MIN_DIFFICULTY_LEVEL && level <= MAX_DIFFICULTY_LEVEL) // within range
                difficultyLevel = level;
            else
                difficultyLevel = DEFAULT_DIFFICULTY_LEVEL;
        // Simplified (overloaded) constructors
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param pts The total points available for this question
         * <p></p>
         * Defines a TrueFalseQuestion with default values for category and difficulty level.
        public TrueFalseQuestion (String text, String answer, int pts)
            // Call pre-existing constructor with default category and difficulty
            this(text, answer, pts, DEFAULT_CATEGORY_VALUE, DEFAULT_DIFFICULTY_LEVEL);
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * <p></p>
         * Defines a TrueFalseQuestion with the default point value, default category,
         * and default difficulty level.
        public TrueFalseQuestion (String text, String answer)
            // Call pre-existing constructor with default points, category and difficulty
            this(text, answer, DEFAULT_POINT_VALUE, DEFAULT_CATEGORY_VALUE,
                 DEFAULT_DIFFICULTY_LEVEL);
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param pts The total points available for this question
         * @param ctgry Category keyword for this question
         * <p></p>
         * Defines a TrueFalseQuestion with the default difficulty level.
        public TrueFalseQuestion (String text, String answer, int pts, String ctgry)
            // Call pre-existing constructor with default points, category and difficulty
            this(text, answer, pts, ctgry,
                 DEFAULT_DIFFICULTY_LEVEL);
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param ctgry Category keyword for this question
         * <p></p>
         * Defines a TrueFalseQuestion with the default point value and the default
         * difficulty level.
        public TrueFalseQuestion (String text, String answer, String ctgry)
            // Use default points and difficulty
            this(text, answer, DEFAULT_POINT_VALUE, ctgry, DEFAULT_DIFFICULTY_LEVEL);
         * @param text The literal wording of this question
         * @param answer The correct answer for this question
         * @param pts The total points available for this question
         * @param level The perceived/intended difficulty level of this question
         * <p></p>
         * Defines a TrueFalseQuestion with the default value for the question category.
        public TrueFalseQuestion (String text, String answer, int pts, int level)
            // Use default category
            this(text, answer, pts, DEFAULT_CATEGORY_VALUE, level);
        // Clients can invoke this method to retrieve the text of the current question.
        // We chose to return the text instead of printing it; this allows the client
        // to decide how it should be presented (via a GUI, over a network, etc.)
        public String getQuestion ()
            return questionText;
        // This method allows the client to store the user's answer inside the
        // TrueFalseQuestion object for easy comparison
        public void submitAnswer (String ans)
            userAnswer = ans;
        // This method reports whether the submitted answer matches the correct answer
        public boolean answerIsCorrect(String userAns) // This version does all the work
            if (userAns == null) // No response from user (yet)
                return false;
            else
                // Normalize and compare answers
                char key = normalize(correctAnswer); // Get 't' or 'f'
                char ans = normalize(userAns); // Get 't' or 'f'
                return (key == ans);
        public boolean answerIsCorrect ()
            return answerIsCorrect(userAnswer); // Call previously-defined version
        public int getPointsValue()
            return pointsValue;
        // Return the points awarded for the user's answer. This method does
        // NOT support partial credit; answers are either correct or incorrect.
        // If the "No-BS" option is selected, blank (unanswered) questions receive
        // 1 point automatically; otherwise, the score will be either 0 or the
        // question's normal points value.
        public int getPointsEarned(boolean useNoBSRule)
    System.out.println("useNoBS: " + useNoBSRule + "\tuserAnswer: " + userAnswer + "\tcorrectAnswer: " + correctAnswer);
            if (useNoBSRule && (userAnswer == null))
                return 1;
            else if (userAnswer == null)
                return 0; // Without "No-BS", treat blank problems as incorrect
            if (answerIsCorrect() == false)
                return 0;
            else
                return pointsValue;
        // This method returns true if the user has submitted an answer
        // for this question (regardless of whether that answer is correct)
        public boolean hasBeenAnswered ()
            return (userAnswer != null);
        // Private helper method to convert all answers to single lowercase
        // letters (in this case, 't' for TRUE and 'f' for FALSE)
        private char normalize (String input)
             if (input != null)
                  input = input.trim(); // Remove leading whitespace
                  input = input.toLowerCase();
                  return input.charAt(0);
             else
                  return ' ';
    import java.util.*;
    * This class represents a complete test or quiz.
    * Data stored:
    * - List of questions
    * - Total score earned
    * - Total score possible
    * - Name/title of test
    * - Instructions
    *  - Category/class assignment
    *  - Student (test-taker) name
    *  - Date test is/was taken
    *  - Time started
    *  - Time completed
    *  - Maximum time allotted
    *  - (List of) Maximum attempts per question
    *  - List of attempts per question
    *  - List of difficulty ratings per question
    *  - Assignment weight
    * Methods:
    * - Constructor
    * - Add question
    * - Display question
    * - Display test
    * - Display instructions
    *      - Generate random exam
    * - Take/administer test
    * - Get score
    * STUFF TO DO:
    * - Add time/date restrictions
    * - Add network access restrictions
    * - Add other restrictions/allowances?
    * @author (your name)
    * @version (a version number or a date)
    public class Test
        // Class constant
        public static final int MAX_NUMBER_OF_QUESTIONS = 10;
        // Class instance variables
        private String testName;
        private int scoreEarned; // What the student earned on the exam
        private int scorePossible; // Total point values of all questions
        private String instructions; // Exam header text
        private ArrayList<TrueFalseQuestion> questions; // Create inside constructor
        // Methods
        public Test (String name, String instr)
            testName = name;
            scoreEarned = 0;
            scorePossible = 0;
            instructions = instr;
            questions = new ArrayList<TrueFalseQuestion>(); //[MAX_NUMBER_OF_QUESTIONS];
        public String getInstructions()
            return instructions;
        public int getScore()
            return scoreEarned;
        public void addQuestion (TrueFalseQuestion q)
            scorePossible += q.getPointsValue();
            questions.add(q); // Automatically append question to end of test
        public String displayQuestion (int position)
            if (position < questions.size())
                return (position+1) + ". " + questions.get(position).getQuestion();
            else
                return null;
        public String displayTest ()
            String result = "";
            for (int i = 0; i < questions.size(); i++)
                result += (i+1) + ". (";
                TrueFalseQuestion t = questions.get(i);
                result += t.getPointsValue();
                result += " points)\n\n" + displayQuestion(i);
                result += "\n\n";
            return result;
        // Get test length (number of questions)
        public int length ()
             return questions.size();
        // Submit answer to a specific question
        public boolean answer(int number, String a)
             // Question numbers run from 0-(max-1) -- THIS WAS AN OFF-BY-ONE ERROR AT FIRST
             if (number >= 0 && number < questions.size())
                  TrueFalseQuestion t = questions.get(number);
                  t.submitAnswer(a);
                  return true; // Question was answered
             else
                  return false; // Unable to answer (nonexistent) question
        // Score exam
        public void scoreExam (boolean useNoBS)
             scoreEarned = 0;
             for (int i = 0; i < questions.size(); i++) // For each question in exam
                  TrueFalseQuestion t = questions.get(i); // get current question
                  scoreEarned += t.getPointsEarned(useNoBS);
    }// Test harness for the Test and *Question classes
    import java.util.*;
    public class QuizDriver
         public static void main(String[] args)
              // Create a new Test object
              Test exam = new Test("Sample Exam", "Select the correct answer for each question");
              setUp(exam);
              Scanner sc = new Scanner(System.in);
              System.out.println(exam.getInstructions());
              // Administer exam
              for (int i = 0; i < exam.length(); i++)
                   // Print out current question
                   System.out.println(exam.displayQuestion(i));
                   // Get user answer
                   System.out.print("Your answer: ");
                   String ans = sc.nextLine();
                   if (ans.equals("")) // Handle blank responses for unanswered questions
                        ans = null;
                   exam.answer(i, ans);
              // Get exam results
              exam.scoreExam(true);
              System.out.println("Your final score was " + exam.getScore() + " points.");
         private static void setUp (Test t)
              TrueFalseQuestion x = new TrueFalseQuestion("The sky is blue.", "true", 2);
              t.addQuestion(x);
              x = new TrueFalseQuestion("The first FORTRAN compiler debuted in 1957", "true", 5);
              t.addQuestion(x);
              x = new TrueFalseQuestion("Spock was a Vulcan", "false", 3);
              t.addQuestion(x);
    }This program is far from finishing.
    I have many questions about this program, but let me ask this one first:
    In the TrueFalseQeustion class, why are there so many constructors? What is the purpose of setting some of the variables to default values?
    Thank you very much!!!
    Edited by: Terry001 on Apr 16, 2008 10:02 AM

    newark wrote:
    Stop ignoring the error messages. You seem to think that an error message means you're doing the assignment wrong. It's probably a simple fix. Post the exact error messages, as well as the code that corresponds to them. The error message will tell you exactly what line the problem occurs on, so you know right where to look.Hi,
    After some modifications, the program now gives me the result the assignment wants when I run it. But I still have trouble with the MultipleChoiceQuestion class
    Here is the complete program
    QuizDriver class
    // Test harness for the Test and *Question classes
    import java.util.*;
    public class QuizDriver
         public static void main(String[] args)
              // Create a new Test object
              Test exam = new Test("Sample Exam", "Select the correct answer for each question");
              setUp(exam);
              Scanner sc = new Scanner(System.in);
              System.out.println(exam.getInstructions());
              // Administer exam
              for (int i = 0; i < exam.length(); i++)
                   // Print out current question
                   System.out.println(exam.displayQuestion(i));
                   // Get user answer
                   System.out.print("Your answer: ");
                   String ans = sc.nextLine();
                   if (ans.equals("")) // Handle blank responses for unanswered questions
                        ans = null;
                   exam.answer(i, ans);
              // Get exam results
              exam.scoreExam(true);
              System.out.println("Your final score was " + exam.getScore() + " points.");
         private static void setUp (Test t)
                                   Question x;
              x = new TrueFalseQuestion("The sky is blue.", "true", 2);
              t.addQuestion(x);
              x = new TrueFalseQuestion("The first FORTRAN compiler debuted in 1957", "true", 5);
              t.addQuestion(x);
              x = new TrueFalseQuestion("Spock was a Vulcan", "false", 3);
              t.addQuestion(x);
              x = new MultipleChoiceQuestion("What is the color of the car\na.Red\nb.Green", "a. Red", 3);
              t.addQuestion(x);
              x = new MultipleChoiceQuestion("What is the name of this class\na.CSE110\nb.CSE114", "b, CSE114", 3);
              t.addQuestion(x);
    }Test
    public class Test
        // Class constant
        public static final int MAX_NUMBER_OF_QUESTIONS = 10;
        // Class instance variables
        private String testName;
        private int scoreEarned; // What the student earned on the exam
        private int scorePossible; // Total point values of all questions
        private String instructions; // Exam header text
        private ArrayList<Question> questions; // Create inside constructor
        // Methods
        public Test (String name, String instr)
            testName = name;
            scoreEarned = 0;
            scorePossible = 0;
            instructions = instr;
            questions = new ArrayList<Question>(); //[MAX_NUMBER_OF_QUESTIONS];
        public String getInstructions()
            return instructions;
        public int getScore()
            return scoreEarned;
        public void addQuestion (Question q)
            scorePossible += q.getPointsValue();
            questions.add(q); // Automatically append question to end of test
        public String displayQuestion (int position)
            if (position < questions.size())
                return (position+1) + ". " + questions.get(position).getQuestion();
            else
                return null;
        public String displayTest ()
            String result = "";
            for (int i = 0; i < questions.size(); i++)
                result += (i+1) + ". (";
                Question t = questions.get(i);
                result += t.getPointsValue();
                result += " points)\n\n" + displayQuestion(i);
                result += "\n\n";
            return result;
        // Get test length (number of questions)
        public int length ()
             return questions.size();
        // Submit answer to a specific question
        public boolean answer(int number, String a)
             // Question numbers run from 0-(max-1) -- THIS WAS AN OFF-BY-ONE ERROR AT FIRST
             if (number >= 0 && number < questions.size())
                  Question t = questions.get(number);
                  t.submitAnswer(a);
                  return true; // Question was answered
             else
                  return false; // Unable to answer (nonexistent) question
        // Score exam
        public void scoreExam (boolean useNoBS)
             scoreEarned = 0;
             for (int i = 0; i < questions.size(); i++) // For each question in exam
                  Question t = questions.get(i); // get current question
                  scoreEarned += t.getPointsEarned(useNoBS);
    }Question
    public class Question
    // Class constants
      public static final int MIN_DIFFICULTY_LEVEL = 1;
      public static final int MAX_DIFFICULTY_LEVEL = 5;
      public static final int DEFAULT_DIFFICULTY_LEVEL = 1;
      public static final int DEFAULT_POINT_VALUE = 1;
      public static final String DEFAULT_CATEGORY_VALUE = "none";
      // Class instance variables
      protected String questionText;
      protected String correctAnswer;
      protected String userAnswer;
      protected int pointsValue;
      protected String category;
      protected int difficultyLevel; //TODO: set a range for difficulty levels
      // Constructors
      public Question (String text, String answer, int pts, String ctgry, int level)
          questionText = text.trim();
          correctAnswer = answer.trim();
          userAnswer = null;
          if (pts >= 1)
              pointsValue = pts;
            else
                pointsValue = DEFAULT_POINT_VALUE;
            category = ctgry.trim();
            if (level >= MIN_DIFFICULTY_LEVEL && level <= MAX_DIFFICULTY_LEVEL)
                difficultyLevel = level;
            else
                difficultyLevel = DEFAULT_DIFFICULTY_LEVEL;
        // Overloaded (simplied) constructors
        public Question (String text, String answer, int pts)
            this(text, answer, pts, DEFAULT_CATEGORY_VALUE, DEFAULT_DIFFICULTY_LEVEL);
        public Question (String text, String answer, int pts, String ctgry)
            this(text, answer, pts, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public Question (String text, String answer, String ctgry)
            this(text, answer, DEFAULT_POINT_VALUE, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public Question (String text, String answer, int pts, int level)
            this(text, answer, pts, DEFAULT_CATEGORY_VALUE, level);
        // Methods
        public String getQuestion ()
            return questionText;
        // Use this method to store user answers
        public void submitAnswer (String ans)
            userAnswer = ans;
        public boolean answerIsCorrect (String userAns)
            if (userAns == null)
                return false;
            else
                // Normalize and compare answers
                char key = normalize (correctAnswer); //Get the first letter of an answer
                char ans = normalize (userAns); //Get the first letter of an answer
                return (key == ans);
        public boolean answerIsCorrect ()// Why do we need two answerisCorrect() methods?
            return answerIsCorrect (userAnswer);
        public int getPointsValue ()
            return pointsValue;
        public int getPointsEarned (boolean userNoBSRule)
            System.out.println ("useNoBS: " + userNoBSRule + "\tuseAnswer: " + userAnswer + "\tcorrectAnswer: " + correctAnswer);
            if (userNoBSRule && (userAnswer == null))
                return 1;
            else if (userAnswer == null)
                return 0;
            if (answerIsCorrect() == false)
                return 0;
            else
                return pointsValue;
        public String getCorrectAnswer ()
            return correctAnswer;
        public boolean hasBeenAnswered ()
            return (userAnswer != null);
        private char normalize (String input)
            if (input != null)
                input = input.trim();
                input = input.toLowerCase();
                return input.charAt(0);
            else
                return ' ';
           TrueFalseQuestion
    public class TrueFalseQuestion extends Question
      public TrueFalseQuestion (String text, String answer, int pts, String ctgry, int level)
          super(text, answer, pts, ctgry, level);
        public TrueFalseQuestion (String text, String answer, int pts)
            super(text, answer, pts, DEFAULT_CATEGORY_VALUE, DEFAULT_DIFFICULTY_LEVEL);
        public TrueFalseQuestion (String text, String answer, int pts, String ctgry)
            super(text, answer, pts, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public TrueFalseQuestion (String text, String answer, String ctgry)
            super(text, answer, DEFAULT_POINT_VALUE, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public TrueFalseQuestion (String text, String answer, int pts, int level)
            super(text, answer, pts, DEFAULT_CATEGORY_VALUE, level);
        // Methods
        public String[] getPossibleAnswerChoice ()
            String[] possibleAnswerChoice = {"true", "false"};
            return possibleAnswerChoice;
    } MultipleChoiceQuestion
    public class MultipleChoiceQuestion extends Question
       public MultipleChoiceQuestion (String text, String answer, int pts, String ctgry, int level)
           super(text, answer, pts, ctgry, level);
        public MultipleChoiceQuestion (String text, String answer, int pts)
            super(text, answer, pts, DEFAULT_CATEGORY_VALUE, DEFAULT_DIFFICULTY_LEVEL);
        public MultipleChoiceQuestion (String text, String answer, int pts, String ctgry)
            super(text, answer, pts, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public MultipleChoiceQuestion (String text, String answer, String ctgry)
            super(text, answer, DEFAULT_POINT_VALUE, ctgry, DEFAULT_DIFFICULTY_LEVEL);
        public MultipleChoiceQuestion (String text, String answer, int pts, int level)
            super(text, answer, pts, DEFAULT_CATEGORY_VALUE, level);
        // Methods
        String possibleAnswers;
        public String getPossibleAnswers ()
            return possibleAnswers;
        public void addAnswerChoice (String answerChoice)
            String ansChoice = answerChoice;
            questionText += "\nansChoice";
            possibleAnswers = answerChoice;
        public void printAnswerChoice ()
            System.out.println (questionText);
    } I don't understand why the assignment wants me to build a method in the MultpleChoiceQuestion class to store the potential answer choices, I can make the program display the potential answer choices by including them in the questionText as following in the QuizDriver class
    Question x;
    x = new MultipleChoiceQuestion("What is the color of the car\na.Red\nb.Green", "a. Red", 3);
    t.addQuestion(x); I don't know how to allow the client to construct the list of answer choices one at a time(add one potential answer choice by calling the addAsnwerChoices() method once)
    Here are a few original sentences of my assignment which describe what I should do with the MultipleChoiceQuestion class
    Using TrueFalseQuestion as a model, develop a new MultipleChoiceQuestion class that can be used to represent a problem where the user must select one of several answer choices (e.g., "Select answer (a), (b), (c), or (d)."). This new question type should have all of the same externally-visible functionality as TrueFalseQuestion, except that it must:
    maintain a list of potential answer choices
    provide a method that allows the client to construct the list of answer choices one at a time (i.e., the client should be able to call an addAnswerChoice() method to pass a new answer option to the MultipleChoiceQuestion.)
    display (as part of the question text) the list of answer choices with appropriate letters ("abcd" instead of "0123") I don't understand what these sentences mean.
    1. "Maintain a list of potential answer choices"-- this reminds me of the getPossibleAnswerChoice() method in the TrueFalseQuestion class
    public String[] getPossibleAnswerChoice ()
            String[] possibleAnswerChoice = {"true", "false"};
            return possibleAnswerChoice;
        }I wonder that if the potential answer choices I have to store in the MultipleChoiceQuestion class are only letters "a", "b", "c", "d", etc, or include the answer text coming after the letters(eg. a.Red, b.Green)
    2. "provide a method that allows the client to construct the list of answer choices one at a time". How do I achieve the functionality "one at a time"? Do I need to pass the input of the client (a potential answer choice) to the variable of the method which stores the list of potential answers?
    3. "display (as part of the question text) the list of answer choices with appropriate letters". My question here is that: When the client type in one possible answer, should I append it to the variable questionText? (So I use the questionText variable in the methods of the first and second steps)
    Thank you very much for your nice help!
    Edited by: Terry001 on Apr 21, 2008 8:01 AM

  • Need SQL Practise Questions

    Hi Experts,
    Can someone provide me with the Medium/Complex problems (practise questions,assignment kind of material) on SQL,PL/SQL.
    Thanks in advance.
    Edited by: 941672 on Jun 30, 2012 7:46 PM

    941020 wrote:
    please provide me also the practice questions
    my email id is [email removed]
    thankyouHaven't you read what BluShadow has posted? I suggest to do it:
    Well, sharing your email on the public internet is a good way to let the spam bots pick it up and start sending you lots of spam. You may want to edit your post and remove your email address and just accept responses on this thread (after all, this isn't a support desk and not everyone is going to want to let you know their email address by email you)
    In answer to your question, try answering some of the SQL and PL/SQL questions people have got on this very forum. It's one of the best ways to learn and there are often some tricky or complex problems to be solved. You don't have to post your answers, just have a go for yourself, and you can also learn from the expert answers given.I think you have enough resources already mentioned in this thread if you want practice questions.
    Regards.
    Al

  • Audit management - question list

    Dear SAPIENTS,
          Does anyone have a document that helps us to record the replies for a question/ questions. Whether the questions, should be set as to give a yes or no answer.
          How and where to record the replies for the questions, bcoz after assignment of the question list only the "not relevant" check box is in modifiable status. The question is not displayed and I do not find any other place to make a tick for yes or no.
    Regards,
    Neeraja

    Dear Gajesh,
          As per your suggestion, I created a valuation specification for yes / no type and created a coded valuation. For this type of questions, the valuation as 100 points for yes answer and 0 for no answer is displayed in the valuation tab of the questions.
         For other questions, where " Percentage Based confirmation is given as Valuation profile, with a valuation proposal as 80 / 60 and the calculation procedure for the question as " Valuation According to fulfilment and minimum 75, there is no valuation displayed ( i.e no of points / result calculated ) as proposed by the system. But the overall audit assessment is given as say 50% and audit failed, subsequent audit required.
      Will the system not show the valuation result for each question. But the questions for which the minimum requirement has not been acheived is shown with the icon referring to " Question valuated. The result is worse than the minimum required result".
       1. Are we to enter the valuation no.of points to enter as the result of the question?
       2. How to upload a question list into the system from excel. It has been given as import can be through XML interface. In that case will the question be displayed in the questions assigned to the audit.
    3. Currently, I have given the question in the description of the question, to be displayed in the question overview of hte icon.  I think this is wrong, but otherwise the system shows only the description. The questions are not displayed.. How to display questions in the audit overview.
    Regards,
    Neeraja

  • Dynamic Shift assignment

    Hi Experts,
    Can anybody please explain when do we use view T552W?. What is Planned/Actual overlap?
    Thanks.

    A dynamic work schedule is used to define the working times of the employee on the basis of the time the employee actually starts work.
    If, for example, I allow an employee to work either from the 9am to 6pm shift or the 9pm to 6am shift and I want to record his/her working times dynamically each day (he/she may come in the morning on monday, at night on tuesday, wednesday, stay for thursday morning, etc.), I can use this feature to dynamically assign a DWS in this employee's personnel work schedule on the basis of when he/she clocked into work.
    The view in question assigns which DWS are permitted for substitution as a dynamic DWS for each PWS.

  • Shared Services, create read access to a cube into an application us a grou

    Hi,
    I have an application with 3 cubes. I have created a group in Shared Services, and i want to give read access only to one cube.
    If i give provision to this group , i only can give read to all the application, so all the cubes are going to have read access.
    How must i do to give only read access to one cube and not to all,
    Thnx
    Guillermo

    Hi,
    This post will help answer your question :- Assigning database access using Shared Services
    If you are using Shared Services access is applied at application level and you can't select individual access to each database.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Help Required in XI certification.

    Does anyone have any sample questions to XI certification for Development Consultants ( TBIT40 , TBIT41, TBIT42, TBIT43, TBIT44). I would be grateful if you could pass it on to [email protected]
    Thanks & Regards,
    Jona

    Hi Guys,
    http://www.****************/CertificationQ/CertificateMain.htm
    Check above link it would give u some idea and u can refresh u r skill by answering it
    Well instead of sticking to TBIT"s get into pattern of the exam and question assignment to each Topics, that makes u to get out of this exam easily.
    I saw Adapters , BPM Monitoring Stuff were given more importance .
    In Adapters : Configuration
    In BPM : Just concept would do
    Mapping : For Ex : JAVA (Jar File) ABAP(Exch Profi Stuff) and overview would help.
    Go more into Thoery for a week atleast (Those u r in constant practise )
    regards
    Srini

  • How to find our PSA Tables Size in my BI System Database ?

    How can we discover the size of PSA Tables  in out BI System.
    my  PSAPSR3 Table space size is 1 TB and want to identify the PSAP size in 1 TB
    Rgds
    PR

    Hi Srinivas
    you can set the amount of space the table is thought to need in the database.Five categories are available in the input help. You can also see here how many data records correspond to each individual category. When creating the table, the system reserves an initial storage space in the database. If the table later requires more storage space, it obtains it as set out in the
    size category. Correctly setting the size category prevents there being too many small extents (save areas) for a table. It also prevents the wastage of storage space when creating extents that are too large.
    You can use the maintenance for storage parameters to better manage databases
    For PSA tables, the maintenance of database storage parameters can be found in the transfer rules maintenance, in the Extras menu. (Go to Change Mode .--> extras --> Maintain DBstorage Parameter)
    You can also assign storage parameters for a PSA table already in the system. However, this has no effect on the existing table. If the system generates a new PSA version, that is, a new PSA table, due to changes in the transfer structure,
    this is created in the data area for the current storage parameters.
    Last Option is
    Go to st14.
    Choose Business WareHouse. now you will find the total size of Bw objects and  you get the size in last 1 month
    If you want full size ...change the date range .
    Pleasure Answering your Question.Assign Points if this is help full
    Santosh Nagaraj
    Edited by: Santosh Nagaraj on Aug 5, 2009 6:25 PM
    Edited by: Santosh Nagaraj on Aug 5, 2009 6:25 PM
    Edited by: Santosh Nagaraj on Aug 5, 2009 6:27 PM

  • BEX Report Writer

    Hi Guru's
    Can anyone send me the interview questoins and answers regarding BEX Report Writer this is urgent please,  Advance thanks
    Thanks & regards
    Sunitha

    these threads can be useful:
    Reporting  Interview questions
    Re: answer please...?
    BEx Questions
    Assign points if useful,
    Gili

  • IVew resizing with mouseover problem!!!

    Hi, 
         We have a portal Full Page IView that hosts a BW Web Application generated by the Web Application Designer. The Web Application fits exactly in the default content pane. 
         When someone does just a mouseover on the "Reduce/Enlarge Navigation Panel" control, the content window resizes just the smallest amount which changes the flow of my web items that were positioned using CSS.
         Our Dev team says that a mouseover on the nav control shouldn't cause any kind of resize of the nav pane or content pane.  They think it might be an event generated by the web application that is somehow being caught and causing the resizing to take place. If so then this is some kind of BW Web Application and Portals Integration issue that maybe SAP needs to look at?
    Any opinions?
    Thanks!

    Closing Question
    Assigning Points

  • Partner profile details for WBI

    Hi all
        this is my requirement.we need to send a file from WBI to SAP as IDOC.i want to know about sender details(i.e) sender port ,sender address,partner number.just suggest me about these things
        Thanks in advance

    Hi ,
              Please refer the folowing links
    /people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters - IDoc to File
    Configurations in R/3 side
    1. SM 59 (RFC destinations)
    Create a RFC destination on the XI server. The connection type should be R/3 connection. The target host needs to be the XI server.
    2. WE 21 (Ports in IDOC processing)
    Create a transactional port. Provide the RFC destination created in this.
    3. BD 54
    Create a logical system.
    4. WE 20 (Partner Profiles)
    a. Create a new partner profile under partner type LS.
    b. Assign the message type in outbound parameters.
    c. Open the message type (Dbl click) and configure the receiver port to the port created.
    Configurations in XI server.
    1. SM59 (RFC destination)
    Configure the RFC destination specific to the R/3 system.
    2. IDX1 (Port maintenance in IDOC Adapter)
    Create a port and provide the RFC destination.
    TESTING:
    WE19 For pushing the idoc in xi through trfc port.
    To be able to trigger your IDOC from the SAP ISU system, you will have to set the partner profile in we20. Select your Business System (mostly under Logical system) and then create Outbound entries for whichever IDOC you want to trigger.
    You define your basic type also in your partner profile settings, Please go thru the following links to get a better idea about partner profile:
    http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b833243d711d1893e0000e8323c4f/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/dc/6b7cd343d711d1893e0000e8323c4f/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/32/692037b1f10709e10000009b38f839/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/5e/b8f8bf356dc84096e4fedc2cd71426/frameset.htm
    Also, I would suggest that you go through this blog by michal if any issue arises,
    /people/michal.krawczyk2/blog/2005/03/29/xi-error--unable-to-convert-the-sender-service-to-an-ale-logical-system
    /people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions
    Assign points if you found helpful
    Regards.,
    V.Rangarajan

Maybe you are looking for

  • Check in / out in document sets

    Hello I use document sets and want to enable check in/out. Whenever someone opens a file that's inside the set, changes something and saves it again, there's no question asked about the required metadata... There's also no green sign that shows that

  • Why doesn't the new iTunes 11 random play work?

    I have chosen random play after album, but iTunes stops after the 1st album is played. Worked perfectly in the previous iTunes version.

  • 3.32 or 3.4?

    We still have numerous W98 machines and most are on Client 3.4SP2. But it appears from Novell's site, we should be using v3.32? Is 3.4 no longer the recommended version? Wondering what the issue is. Thanks! Susanne

  • IPhoto won't lauch after OSX Lion update, how to resolve?

    I'm running a Macbook pro 13" October 2010. 2.4GHZ 4GB RAM. Everytime I try to launch iphoto it bounces around for a few seconds then gives me an error message. I DON'T use Time machine so that's not an option. I have lots of photos that I'd definite

  • Does WLS 6.1 Support JDK 1.4

    Hi, We are process of upgrading JDK 1.3 to JDK 1.4 and wanted to know if WLS Express 6.1 Sp2 supports it. If not is there going to be a patch coming out soon ? Please let us know. Thanks,