Question
[JAVA] public class Zn extends Ring { public static int n; // construct a Zn element from integer public Zn(int a ) // return a
[JAVA]
public class Zn extends Ring
{
public static int n;
// construct
a Zn element from integer
public Zn(int
a
)
// return a string in the form [3]
public String toString()
}
public class Complex extends Field {
// construct the complex number x + yi
public Complex(double x, double y)
// return a string in the form
-
3+4i
public String toString()
}
The
Ring
and
Field
classes are defined as:
public abstract class Ring {
public
abstract Ring add(Ring other);
public
abstract Ring sub(Ring other);
public
abstract Ring mul(Ring other);
}
public abstract class Field extends Ring {
public abstract Field div(Field other);
}
Implement the following two Java classes. Zn encapsulates the elements of the ring Zn, integers modulo n. Complex encapsulates the complex numbers. public class Zn extends Ring t public static int n; construct a Zn element from integer public Zn (int a) return a string in the form "[3]" public String to String public class Complex extends Field t construct the complex number x yi public Complex (double x, double y) return a string in the form "-3+4i" public String to String The Ring and Field classes are defined as: public abstract class Ring public abstract Ring add (Ring other); public abstract Ring sub (Ring other); public abstract Ring mul (Ring other); public abstract class Field extends Ring public abstract Field div(Field other); Implement the following two Java classes. Zn encapsulates the elements of the ring Zn, integers modulo n. Complex encapsulates the complex numbers. public class Zn extends Ring t public static int n; construct a Zn element from integer public Zn (int a) return a string in the form "[3]" public String to String public class Complex extends Field t construct the complex number x yi public Complex (double x, double y) return a string in the form "-3+4i" public String to String The Ring and Field classes are defined as: public abstract class Ring public abstract Ring add (Ring other); public abstract Ring sub (Ring other); public abstract Ring mul (Ring other); public abstract class Field extends Ring public abstract Field div(Field other)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started