60 373
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #15912 in C# for leena

Question #15912
Define a class vector to hold 3 integer values. Include operator methods such that we shall be able to perform these operations on the vector object V1, V2 & V3.
1)V3=V1+V2;
2)V3=5*V1;
3)V3=V2*5;
4)int m= V1*V2
Expert's answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
public class Vector
{
& int a, b, c;
& public Vector plus(Vector k)
& {
Vector D = new Vector();
D.a = a + k.a;
D.b = b + k.b;
D.c = c + k.c;
return D;
& }
& public Vector plusMultiply5()
& {
Vector D = new Vector();
D.a = a * 5;
D.b = b * 5;
D.c = c * 5;
return D;
& }
& public int muliply(Vector D)
& {
return D.a * a + D.b * b + D.c * c;
& }
}
class Program
{
& static void Main(string[] args)
& {

& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions