Write a java program to implement the finite field

Assignment Help JAVA Programming
Reference no: EM1359911

Write a program called "GF2.java" to implement the finite field GF(pn) where p is a prime number and n is a positive integer.  You also need to write four methods to realize "+", "-", "´", and "/".

Specifically, your program will read parameters and polynomials from a file named "input.txt" (under the same directory). Then your program needs to create a file named "output.txt" (under the same directory) and prints the results to "output.txt". (Please check the attached sample "input.txt" and "output.txt".)

In "input.txt":

1.     First line is the prime number p.

2.     Second line is the degree n of the irreducible polynomial m(x) over Zp.

3.     Third line is the coefficients of m(x), from leading coefficient to the constant, separated by one blank space.

4.     Fourth Line is the degree of f(x) over Zp.

5.     Fifth line is the coefficients of f(x), from leading coefficient to the constant, separated by one blank space.

6.     Sixth line is the degree of g(x) over Zp.

7.     Seventh line is the coefficients of g(x), from leading coefficient to the constant, separated by one blank space.

In "output.txt":

1.     First line is the coefficients of f(x)+g(x) (mod m(x)), from leading coefficient to the constant, separated by one blank space.

2.     Second line is the coefficients of f(x)-g(x) (mod m(x)), from leading coefficient to the constant, separated by one blank space.

3.     Third line is the coefficients of f(x)*g(x) (mod m(x)), from leading coefficient to the constant, separated by one blank space.

4.     Fourth line is the coefficients of f(x)/g(x) (mod m(x)), from leading coefficient to the constant, separated by one blank space (don't forget to handle the case of g(x) = 0).

Important: leading coefficient should not be 0 unless the polynomial is 0.

Example 1: if p = 3, m(x) = x2 + 1, f(x) = 2x, g(x) = x + 1, then f(x) + g(x) = 1 instead of 0x + 1. Thus in the first line of "output.txt" it should print 1 instead of 0 1.

Example 2: if p = 3, m(x) = x2 + 1, f(x) = 2x + 2, g(x) = x + 1, then f(x) + g(x) = 0 instead of 0x + 0. Thus in the first line of "output.txt" it should print 0 instead of 0 0.

You need to create a java file "GF2.java" to blackboard. The program will be tested using command line.

 "javac GF2.java"

to compile it and type

"java GF2"

to run it.

The files "GF2.java" and "input.txt" will be placed in the same directory. Your program needs to output the file "output.txt" to the same directory. 

Reference no: EM1359911

Questions Cloud

Are mandatory limits on environmentally damaging practices : Are mandatory limits on environmentally damaging practices likely to be more or less successful than voluntary limits?
Policy brief : Assume you are working for the Centers for Medicare and Medicaid Services (CMS) and have been asked to prepare a briefing document for your boss on the Medicaid matching grant. He/she needs to make a briefing to Congress and is not aware of the struc..
Using the eoq model, how many should ray order : Using the EOQ model, how many should Ray order?   Please provide the formula, at least one step of calculation, and the correct order size.
Logistic regression : Marentette and El-Masri (2011) used logistic regression to identify predictors of obtaining seasonal influenza vaccination among hospital-based nurses in Canada.  Their results are shown in table 1:
Write a java program to implement the finite field : Write a program called "GF2.java" to implement the finite field GF(p n ) where p is a prime number and n is a positive integer.  You also need to write four methods to realize "+", "-", "´", and "/".
The effect of fluid cooling : Write a  literature review and the title is "the effect of fluid cooling on the performance of building integrated photovoltaic thermal systems. Using some BIPVT prototypes measure their thermal and electrical output and dtermine their effectiveness"
Which critically examines the benefits and risks to company : Which critically examines the benefits and risks to a company, of incorporating corporate debt into a portfolio of equity and debt.
Prepare trail balance ,prepare income statement : Journalize May transactions. post entries to general ledger, Prepare trail balance ,Prepare income statement, owners' equity statement and balance sheet.
Environmental economics and policy : Choose any one topic out of the following , • Water , • Energy , • Agriculture , • Forest

Reviews

Write a Review

JAVA Programming Questions & Answers

  Java problem - g queue

A queue is an ordered collection of items in which the removal of items is restricted to the FIFO ( rst in rst out) principle.

  Write a class array that encapsulates an array

Write a class Array that encapsulates an array and provides bounds-checked access. The private instance variables should be int index and inarray[10]. The public members should be a default constructor and methods (signatures shown below) to provide ..

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Mean and standard deviation using using eclipse

Java programming to calculate Mean and standard deviation using Using Eclipse.

  Data structures and algorithms

Code analysis and programming.

  Communication with an smtp server

Develop a graphical user interface based java program that can communicate with a real SMTP email server for sending emails

  Prepare a program that constructs a binary tree

Write your own implementation of primitive operations and use self-referential classes in your implementation.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Modeling the caves

Assignment 2 Description:  You are a mighty warrior, and armed with your trusty bow and 3 arrows, you enter The Caves in search of the mighty Wumpus. If you shoot the Wumpus, you are victorious and the masses will praise you, but if you stumble upon ..

  Create system in java using agile approach

You are a software manager in company which designs critical control software for aircraft. Create system in Java using agile approach with a user involved in the development team.

  Function using javascript syntax to compute gross pay

Write a function using JavaScript syntax to compute a person's gross pay for a week. The function must receive the number of hours worked and the rate of pay per hour.

  Implement avl tree

Implement AVL trees that allows both iterative traversal and recursive traversal.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd