А.) Для кожного завдання класи (чи інтерфейси) повинні наслідувати інтерфейси ICloneable, IComparable. В завданні додатково необхідно утворити клонований масив, який посортувати за певним критерієм і вивести результат. Б) Також покрити код юніт тестами 2.Визначити інтерфейс INumber з арифметичними операціями додавання, віднімання, множення, ділення; інтерфейс IInputOutput для форматного введення-виведенням INumber. Класи ComplexNumber та RealNumber повинні реалізувати ці два інтерфейси. В класі Task визначити методи, які знаходять суму, добуток та середнє арифметичне значення елементів заданого масиву типу INumber. Ввести два масиви – комплексних та дійсних чисел, застосувати методи з класу Task.
task4-interfaces-e-learning's Introduction
task4-interfaces-e-learning's People
Forkers
ivanternovyitask4-interfaces-e-learning's Issues
Too long return value
public INumber Multiply(INumber iNumber)
{ //a+bi //c+di //(ac - bd) + (ad + bc)i
ComplexNumber second = iNumber as ComplexNumber;
return new ComplexNumber(Real * second.Real - Imaginary * second.Imaginary, Real * second.Imaginary + Imaginary * second.Real);
}
i think better change to:
ComplexNumber result = new ComplexNumber(Real * second.Real - Imaginary * second.Imaginary, Real * second.Imaginary + Imaginary * second.Real);
return result;
OutputSortClonedNumbers()
public static void OutputSortClonedNumbers()
{
RealNumber[] arr = new RealNumber[10];
for (var i = 0; i < 10; ++i)
{
arr[i] = new RealNumber(i*i-2*i-4);
}
RealNumber[] arr2 = (RealNumber[]) arr.Clone();
Array.Sort(arr2);
Console.WriteLine("Sorted cloned array: ");
foreach (var it in arr2)
{
it.FormatOutput();
}
}
too many actions for 1 function and strange way for making values for numbers(ii-2i-4)
IOExceptions
Add IOExceptions for input methods
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.