Answer to Question #16720 in Java | JSP | JSF for Rory




 The class has the following contructors and methods:
 
* A default constructor that sets the rational numbers to 0/1
 * A constructor that has parameters for the numerator and denominator and converts the resulting ratio to simplified form.
 * simplify--a private method that converts the rational numbers to simplified form.
 * geGCD (x, y )--a private static method that returns the largest common factor of the two positive integers x and y, that is, their greatest common divisor. For example, the greatest common divisor of 40 and 12 is 4.
 * getValue--returns the rational number as a double value.
 * toString--returns the rational number as a string in the form a/b.
Unfortunately, your question requires a lot of work and cannot be done for free.   
Submit it with all requirements as an assignment to our control panel and we&#039;ll assist you.
Definition used:  

Congruence.  

Let m be an integer greater than 1. If xand yare integers, then x is congruent to y modulo m if x — y is divisible by m. It can be represented as \(\displaystyle{x}={y}{\left({b}\ mod\ {m}\right)}\). This relation is called as congruence modulo m.  

Calculation:   

Consider the values and congruence classes modulo m,  

\(\displaystyle{\left[{13}\right]}^{{{6}}}\) and m = 15.  

It is evident that [x]=[y] if \(\displaystyle{\left[{x}={y}{\left({b}\ mod\ {m}\right)}\right]}\). Since \(\displaystyle{13}=-{2}{\left({b} \ mod \ {15}\right)}\).  

Then,  

[13]=[-2]  

\(\displaystyle{\left[{13}\right]}^{{{6}}}={\left[-{2}\right]}^{{{6}}}\)  

\(\displaystyle={\left[{\left(-{2}\right)}^{{{6}}}\right]}\)  

=[64]  

Since, by the principal or congruence \(\displaystyle{64}={4}{\left({b}\ mod \ {15}\right)}\). Therefore, \(\displaystyle{\left[{13}\right]}^{{{6}}}={\left[{4}\right]}\) in \(\displaystyle{Z}\_{{{15}}}\).  

Therefore, the value of the expression is [4]. we know that dividend = divisor × quotient + remainderaccording to the problem :dividend 1 = 245dividend 2 = 1029dividend - remainder = divisor × quotientso dividend 1- remainder = 240 = divisor × quotient 1prime factor of 240 = 24 × 3 × 5dividend 2 – remainder = 1024 = divisor × quotient 2prime factor of 1024 = 24 × 26since, the divisor is common for both the numbers we need to find the highest common factor between both the numbers. from the prime factors, we find thehighest common factor between the two numbers is 24 = 16 method a.increment() overlaps in class b.   
 therefore, regardless of the type of the variable obj, will be called the method corresponding to the actual type of the object - that is, b.increment().  
 
this method will use the variable i, declared in the same class b and having an initial value of 10.  
 
the resulting value - 11. > StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.
> 
> 


(API doc for StringTokeniser)



You should do a lot better by reading one whole line at a time then splitting it (String split method) on the tab delimiters to get a String array. I haven't tested this but you should get array elements of "" where there are consecutive tabs, although it may be better to trim() the elements to get rid of any spurious blanks. && is a short circuit operator in java, which means that once it evaluates the left expression as false - it no longer evaluates the right expression.   

in our case, in the equals method evaluates 

```

obj instanceof person 
```
 to **true**; 

```

this.age == ((person)obj).age 
```
 to **false**; the next expression, 
```

this.name.equals(((person)obj).name);
```
 is not evaluated at all, and the method returns **false**.   

changing the && operator to || or & would result in a java.lang.nullpointerexception common factor of 4 and 5 is only 1∴ is in standard formcommon factor of 5 and 4 is only 1∴ is in standard formcommon factor of 16 and 25 is only 1∴ is in standard formhence, is equivalent to The problem is that your pair's closure must return two different types of objects: int if you ask for "con", and the next closure on the line if you ask for "crd".


Here's one possible implementation:


Use a speaker so you can come back.



```
public static Func<string, dynamic> Pair(int x, Func<string, dynamic> y)
{
    Func<string, dynamic> pair =
           (a) =>
           {
               if (a == "con") return x;
               if (a == "crd") return y;
               throw new Exception();
           };

    return pair;
}

public static void Print(Func<string, dynamic> pair)
{
    while (true)
    {
        var next = pair("crd");
        Console.WriteLine((next == null ? "-":"+") +"> " + pair("con"));
        if (next != null)
        {
            Console.WriteLine("|");
            pair = (x) => next(x);
            continue;
        }
        break;
    }
}

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```


  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

Test:



```
var pair = Pair(1,
            Pair(2,
                  Pair(3,
                        Pair(4, null))));

Print(pair);

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

output:



```
+> 1
|
+> 2
|
+> 3
|
-> 4

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
``` I just posted an example of this over in a similar thread about JTable [here](/software-development/java/threads/373078/1605358#post1605358). Perhaps it will help. direction: a word and number arrangement machine when given an input line of word and numbers rearranges them following a particular rule in each step. the following is an illustration of input and rearrangement. input: politics 61 policy 116 partner 93 role 45 clear 27 38 point step i: role politics policy 116 partner 93 45 clear 27 38 point 61 step ii: role clear politics policy partner 93 45 27 38 point 116 61 step iii: role clear partner politics policy 93 45 38 point 27 116 61 step iv: role clear partner politics policy 93 38 point 45 27 116 61 step v: role clear partner politics point policy 93 38 45 27 116 61 step v, is the last step of the above arrangement as the intended arrangement is obtained. as per the rule followed in the given steps find out the appropriate steps for the given input. input: energy 54 78 place 23 issue 211 145 flat rent taxi 17in step iii, what is the difference between fifth element from left and second element from right? generaloraverage rate is the change in the concentration of a compound over a period of time.the average rate the reactants and products in a reaction are equal when the coefficient for each is 1.the rate for the reactants are negative. this is because the reactants are being consumed in the reaction. the rate for the product c is positive because it is being produced in the reaction.for a reaction where the coefficients of the compounds are different, the rate is multiplied by the reciprocal of the coefficient.example: 2a + b → 3cthe given reaction is:3o2(g) → 2o3(g)­given the rate of o2 consumption is -2.17x10-5 mol/l∙snote that value is negative to indicate that it is decreasing as the reaction proceeds.rearranging the rate equation to give the reaction rate is terms of [o3]: