Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[JAVA] public class Zn extends Ring { public static int n; // construct a Zn element from integer public Zn(int a ) // return a

[JAVA]

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions