Write a program called gf2java to implement the finite

Assignment Help JAVA Programming
Reference no: EM13366965

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: EM13366965

Questions Cloud

Write a short essay of approximately 750 words on the : write a short essay of approximately 750 words on the following topic.nbspare mandatory limits on environmentally
Policy briefassume you are working for the centers for : policy briefassume you are working for the centers for medicare and medicaid services cms and have been asked to
1 rays satellite emporium wishes to determine the best : 1. rays satellite emporium wishes to determine the best order size for its best-selling satellite dish. ray has
Hw5 logistic regression1 nbspmarentette and el-masri 2011 : hw5 logistic regression1. nbspmarentette and el-masri 2011 used logistic regression to identify predictors of obtaining
Write a program called gf2java to implement the finite : write a program called gf2.java to implement the finite field gfpn where p is a prime number and n is a positive
Write anbspliterature review and the title is the effect of : write anbspliterature review and the title is the effect of fluid cooling on the performance of building integrated
Questionnbspnbspwhich critically examines the benefits and : questionnbspnbspwhich critically examines the benefits and risks to a company of incorporating corporate debt into a
Prepare trail balance income statement owners equity : prepare trail balance income statement owners equity statement and balance sheet.journalize may transactions.post
Choose any one topic out of the followingnbspbull : choose any one topic out of the followingnbspbull waternbspbull energynbspbull agriculturenbspbull forestnbspassignment

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  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.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  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.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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