Question

In: Computer Science

Task : (Please Answer in C#) Class Polynomials The class Polynomials is a collection of polynomials...

Task : (Please Answer in C#)

Class Polynomials

The class Polynomials is a collection of polynomials of either implementation stored in an instance of the generic library class List.

class Polynomials

{

private List L;

// Creates an empty list L of polynomials

public Polynomials ( )

{ … }

// Retrieves the polynomial stored at position i in L

public Polynomial Retrieve (int i)

{ … }

// Inserts polynomial p into L

public void Insert (Polynomial p)

{ … }

// Deletes the polynomial at index i

public void Delete (int i)

{ … }

// Returns the number of polynomials in L

public int Size ( )

{ … }

// Prints out the list of polynomials

public void Print ( )

{ … }

}

Solutions

Expert Solution

Solution :

Short Summary:

Implemented all the methods as per the requirement
Attached source code and screenshot
**************Please do upvote to appreciate our time. Thank you!******************

Source Code:

import java.util.ArrayList;
import java.util.List;

/** The class Polynomials is a collection of polynomials of either implementation stored in an instance of the
generic library class List. **/
class Polynomials
{
private List<Polynomial> L;
// Creates an empty list L of polynomials
public Polynomials ( )
{
L=new ArrayList<>();  
}
// Retrieves the polynomial stored at position i in L
public Polynomial Retrieve (int i)
{
return L.get(i);
}
// Inserts polynomial p into L
public void Insert (Polynomial p)
{
L.add(p) ;
}
// Deletes the polynomial at index i
public void Delete (int i)
{
L.remove(i) ;
}
// Returns the number of polynomials in L
public int Size ( )
{

return L.size(); }
// Prints out the list of polynomials
public void Print ( )
{
for(Polynomial pol:L)
{
System.out.println(pol.toString());  
}
}


}

Code Screenshot:

Thank you...!


Related Solutions

implement please... ........................................... public class TernarySearch {     /** Task: Searches for a value in an array....
implement please... ........................................... public class TernarySearch {     /** Task: Searches for a value in an array.      * @param a an array of Comparable objects      * @param desiredItem an item to search for         * @param n an integer > 0      */     public static <T extends Comparable<? super T>>     boolean ternarySearch(T[] a, T desiredItem, int n)     {         // it is assumed that the data is already sorted         return ternarySearch(a, 0, n-1, desiredItem);     } // end ternarySearch     /** Task: recursive ternarySearch search through...
Complete the following task in C++. Separate your class into header and cpp files. You can...
Complete the following task in C++. Separate your class into header and cpp files. You can only useiostream, string and sstream. Create a main.cpp file to test your code thoroughly. Given : commodity.h and commodity.cpp here -> https://www.chegg.com/homework-help/questions-and-answers/31-commodity-request-presented-two-diagrams-depicting-commodity-request-classes-form-basic-q39578118?trackid=uF_YZqoK Create : locomotive.h, locomotive.cpp, main.cpp Locomotive Class Hierarchy Presented here will be a class diagram depicting the nature of the class hierarchy formed between a parent locomotive class and its children, the two kinds of specic trains operated. The relationship is a...
Complete the following task in C++. Separate your class into header and cpp files. You can...
Complete the following task in C++. Separate your class into header and cpp files. You can only use iostream, string and sstream. Create a main.cpp file to test your code thoroughly. Given : commodity.h and commodity.cpp here -> https://www.chegg.com/homework-help/questions-and-answers/31-commodity-request-presented-two-diagrams-depicting-commodity-request-classes-form-basic-q39578118?trackid=uF_YZqoK Given : locomotive.h, locomotive.cpp, main.cpp -> https://www.chegg.com/homework-help/questions-and-answers/complete-following-task-c--separate-class-header-cpp-files-useiostream-string-sstream-crea-q39733428 Create : DieselElectric.cpp DieselElectric.h DieselElectric dieselElectric -fuelSupply:int --------------------------- +getSupply():int +setSupply(s:int):void +dieselElectric(f:int) +~dieselElectric() +generateID():string +calculateRange():double The class variables are as follows: fuelSuppply: The fuel supply of the train in terms of a number of kilolitres...
Iterating a method over a collection of objects is a common task that you may complete...
Iterating a method over a collection of objects is a common task that you may complete unknowingly each day. Within a collection of similar things, you identify the characteristics that make the individual elements unique and treat them differently according to their classifications. For example, assume that you are at a store and want to pay for something in cash. The bills in your wallet or purse represent a collection of similar objects, differentiated by denomination. It would not be...
C++ please #include <iostream> using namespace std; /** * defining class circle */ class Circle {...
C++ please #include <iostream> using namespace std; /** * defining class circle */ class Circle { //defining public variables public: double pi; double radius; public: //default constructor to initialise variables Circle(){ pi = 3.14159; radius = 0; } Circle(double r){ pi = 3.14159; radius = r; } // defining getter and setters void setRadius(double r){ radius = r; } double getRadius(){ return radius; } // method to get Area double getArea(){ return pi*radius*radius; } }; //main method int main() {...
please debug this by fixing all the mistakes in C# // Creates a BoatLicense class //...
please debug this by fixing all the mistakes in C# // Creates a BoatLicense class // And instantiates three BoatLicense objects // The price of a licence is $25 if the boat motor is 50 HP or under // and $38 if the HP is over 50 // Boat licenses are issued with numbers starting with 200801 using System; public class DebugSeven4 {    public static void Main()    {       const int STARTINGNUM = 200801;       BoatLicense[] license =...
please debug this by fixing all the mistakes in C#: // Creates a Breakfast class //...
please debug this by fixing all the mistakes in C#: // Creates a Breakfast class // and instantiates an object // Displays Breakfast special information using System; public class DebugSeven2 {    Breakfast special = new Breakfast("French toast", 4.99);    //Display the info about breakfast    Console.WriteLine(Breakfast.info);    // then display today's special    Console.WriteLine("Today we are having {0} for {1}",       special.Name, special.Price.ToString("C2")); } class Breakfast {    // info is class field    public static string info =...
PLEASE DO IN C++ (Math: The Complex class) The description of this project is given in...
PLEASE DO IN C++ (Math: The Complex class) The description of this project is given in Programming Exercise 14.7 in the Chapter 14 Programming Exercise from the Book section. If you get a logical or runtime error, please refer https://liangcpp.pearsoncmg.com/faq.html. Design a class named Complex for representing complex numbers and the functions add, subtract, multiply, divide, abs for performing complex-number operations, and the toString function for returning a string representation for a complex number. The toString function returns a+bi as...
Write a Fraction Class in C++ PLEASE READ THE ASSINGMENT CAREFULY BEFORE YOU START, AND PLEASE,...
Write a Fraction Class in C++ PLEASE READ THE ASSINGMENT CAREFULY BEFORE YOU START, AND PLEASE, DON'T ANSWER IT IF YOU'RE NOT SURE WHAT YOU'RE DOING. I APPRECIATE IF YOU WRITE COMMENTS AS WELL. WRONG ANSWER WILL GET A DOWNVOTE Thank in Advance. Must do; The class must have 3 types of constructors; default, overloaded with initializer list, copy constructor You must overload the assignment operator You must declare the overloaded output operator as a friend rather than part of...
Problem 6. Let Pd (2, C) denote the vector space of C-polynomials in two variables, of...
Problem 6. Let Pd (2, C) denote the vector space of C-polynomials in two variables, of degree ≤ d. Define a linear map S : P2(2, C) → P2(C) by S(p) := p(z, z) (where z is a variable for the polynomials in P2(C)). (a) Prove that S is surjective and that Skew2(2, C) ⊂ ker(S). (b) Give an example of a polynomial in ker(S) \ Skew2(2, C). Hence write down a basis for ker(S).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT