1
00:00:02,310 --> 00:00:03,210
Hello everyone.

2
00:00:03,270 --> 00:00:06,070
So I hope for Glass is no clear to you all.

3
00:00:06,240 --> 00:00:08,850
If it is not clear then please do it again.

4
00:00:08,850 --> 00:00:11,120
Try to create friction glass on your own.

5
00:00:11,340 --> 00:00:15,620
In this session I will discuss a problem that you guys will implement.

6
00:00:15,660 --> 00:00:19,330
I am just giving you a brief introduction on how to implement it.

7
00:00:19,500 --> 00:00:22,230
In the last session we implemented refreshing glass.

8
00:00:22,230 --> 00:00:26,920
So now you guys have to implement complex no glass so enmeshed complex.

9
00:00:27,100 --> 00:00:27,700
So in metals.

10
00:00:27,720 --> 00:00:37,010
There are complex numbers so a complex number is like we have a real part and we have imaginary part

11
00:00:37,790 --> 00:00:39,500
real part and imaginary part.

12
00:00:39,500 --> 00:00:41,990
This is called order.

13
00:00:42,190 --> 00:00:52,350
Some people represented with g or so but prefer this i okay So example is three plus four I order.

14
00:00:52,490 --> 00:00:57,840
Okay so this is a complex number so complex number is two parts real part and imaginary part.

15
00:00:57,860 --> 00:01:02,060
So how we will implement this glass how we will implement complex no glass.

16
00:01:02,150 --> 00:01:12,490
So first of all we will have two private properties two private data members real and imaginary so these

17
00:01:12,490 --> 00:01:16,440
will be two private data members to private properties.

18
00:01:16,480 --> 00:01:19,120
Okay so they both will be private.

19
00:01:19,120 --> 00:01:19,780
Now let's see

20
00:01:24,140 --> 00:01:26,620
so let's say this line line.

21
00:01:26,620 --> 00:01:28,820
MARTIN So what is this.

22
00:01:28,830 --> 00:01:34,110
It is a constructor so this is a paramedic's constructor and this better amortized constructor is taking

23
00:01:34,110 --> 00:01:35,580
two values first.

24
00:01:35,640 --> 00:01:38,300
The real part and second is the imaginary part.

25
00:01:38,960 --> 00:01:48,130
Okay so for example how we will create object so a complex number name of the class when and legendary

26
00:01:48,130 --> 00:01:50,800
all parties 3 and the imaginary part is 5.

27
00:01:50,800 --> 00:01:56,350
So what will happen in the paramedics constructor a real part will be set to three real part will become

28
00:01:56,350 --> 00:01:59,790
three and the imaginary part will become five okay.

29
00:01:59,930 --> 00:02:02,440
Dale Bartlett welcome to reimagining but will become five.

30
00:02:02,470 --> 00:02:04,930
So I am using parameters constructor here.

31
00:02:04,930 --> 00:02:10,900
So wipe Adam or those constructor because if a user wants to create object of my class he has to give

32
00:02:10,900 --> 00:02:13,170
the value of real part and they match any part.

33
00:02:13,210 --> 00:02:16,790
So my real or imagined part will never contain garbage value.

34
00:02:16,870 --> 00:02:19,270
Okay they will never contain garbage value.

35
00:02:19,390 --> 00:02:22,520
After that I will take a choice as input from the user.

36
00:02:22,540 --> 00:02:25,880
So if the choice is one I am calling a function.

37
00:02:25,950 --> 00:02:28,150
C1 dart plus C2.

38
00:02:29,260 --> 00:02:34,650
So plus is a function plus a function that you guys will implement.

39
00:02:34,660 --> 00:02:36,220
So what best function will do.

40
00:02:36,220 --> 00:02:37,720
It will add to complex number.

41
00:02:37,720 --> 00:02:43,250
So C2 is a barometer to the argument of type complex number.

42
00:02:43,440 --> 00:02:45,630
Okay so what display function will do.

43
00:02:45,630 --> 00:02:49,410
It will add to complex numbers and put that is our even.

44
00:02:49,590 --> 00:02:54,430
So add two complex numbers see when plus you two and put that in there didn't see one.

45
00:02:54,840 --> 00:03:01,310
Just like we did in the faction class we will add two complex number and four that is in complex numbers

46
00:03:01,310 --> 00:03:02,230
even.

47
00:03:02,340 --> 00:03:04,040
Okay so you two will remain unchanged.

48
00:03:04,110 --> 00:03:07,140
CO2 remains unchanged.

49
00:03:07,210 --> 00:03:08,270
OK so what is that.

50
00:03:08,330 --> 00:03:12,170
But rather than type of the plus function we don't have will be void.

51
00:03:12,170 --> 00:03:14,960
We are not attending anything.

52
00:03:15,100 --> 00:03:17,640
Okay so how do I do complex number.

53
00:03:17,680 --> 00:03:26,730
So suppose 7 is 3 plus 4 iota and c 2 is 5 plus one iota.

54
00:03:26,740 --> 00:03:31,910
So what will be C when plus you to see plus you two will be real part plus real part.

55
00:03:31,990 --> 00:03:34,070
So eight plus five.

56
00:03:34,070 --> 00:03:35,200
IOTA okay.

57
00:03:35,530 --> 00:03:37,690
So this will be our new value of seven.

58
00:03:37,690 --> 00:03:41,040
So this will become C1 and C2 will remain unchanged.

59
00:03:41,110 --> 00:03:42,650
CO2 remains unchanged.

60
00:03:42,730 --> 00:03:45,450
So this is how we are a complex number.

61
00:03:45,520 --> 00:03:50,440
So you have to compare this plus function you have to write this plus function.

62
00:03:50,440 --> 00:03:57,310
And then after doing plus after doing plus operation what we are doing we are printing we are printing.

63
00:03:57,310 --> 00:04:05,020
So how we will print we will print real part first then plus then iota and then imaginary part.

64
00:04:05,020 --> 00:04:05,250
Okay.

65
00:04:05,260 --> 00:04:11,760
So this is how we print a complex number.

66
00:04:11,910 --> 00:04:13,730
So what if the choice is.

67
00:04:14,090 --> 00:04:17,770
If the choice is to I have a function called C1 multiply.

68
00:04:17,990 --> 00:04:20,920
So he went out multiply C2.

69
00:04:21,050 --> 00:04:24,260
So this multiply is a function that you guys have to implement.

70
00:04:24,620 --> 00:04:31,280
So this multiply function doesn't have any return type of return type is void and it will take object

71
00:04:31,270 --> 00:04:32,970
of type complex number.

72
00:04:32,990 --> 00:04:33,250
Okay.

73
00:04:33,260 --> 00:04:33,980
So this.

74
00:04:34,340 --> 00:04:36,360
So this multiply function what will do.

75
00:04:36,470 --> 00:04:41,400
It will take to complex number 7 as you do multiply them and put there is urgency when.

76
00:04:41,420 --> 00:04:48,680
Okay so multiply too complex the embassy went into you 2 and put that urgency when you two will remain

77
00:04:48,710 --> 00:04:49,740
unchanged.

78
00:04:49,820 --> 00:04:50,290
Okay.

79
00:04:50,390 --> 00:04:53,930
So do you guys know how to multiply two complex number.

80
00:04:53,960 --> 00:05:03,590
So I am just giving you of beef idea so let's say C when is three plus 4 I order and C two is five plus

81
00:05:03,590 --> 00:05:04,990
one iota.

82
00:05:05,090 --> 00:05:11,090
So C when multiplies you to so first of all real part multiply really part.

83
00:05:11,160 --> 00:05:13,500
So three into five with a negative sign.

84
00:05:13,530 --> 00:05:14,240
Why negative sign.

85
00:05:14,250 --> 00:05:19,340
Because I would test queries minus one and then imagine about my GPA imaginary part so forward into

86
00:05:19,340 --> 00:05:20,340
one.

87
00:05:20,580 --> 00:05:23,070
So this will be your real part.

88
00:05:23,070 --> 00:05:24,680
Now it's time for the imaginary part.

89
00:05:24,690 --> 00:05:30,770
So I order so imaginary part will be three to one plus four and do five.

90
00:05:31,110 --> 00:05:33,020
Okay so what is the formula.

91
00:05:33,030 --> 00:05:34,620
Formula is very simple.

92
00:05:34,750 --> 00:05:46,470
A real part of C1 real part C1 multiply real part C two negative sine imaginary Part C even multiply

93
00:05:46,620 --> 00:05:48,890
imaginary part C two.

94
00:05:48,930 --> 00:06:02,570
So this will be your real and the imaginary part will be a real part of C1 multiply imaginary part of

95
00:06:02,720 --> 00:06:11,920
C2 plus sine real part of C to multiply imaginary part of C even.

96
00:06:11,950 --> 00:06:16,630
Okay so this is the formula for multiplying two complex number.

97
00:06:16,650 --> 00:06:20,070
I hope you guys already know this formula but in case you would run.

98
00:06:20,070 --> 00:06:22,170
No I just gave you the formula.

99
00:06:22,170 --> 00:06:27,380
So what we are doing here is after the multiplication we are printing seven seven dot print.

100
00:06:27,540 --> 00:06:33,720
So print is also a function print is also a function so print is not taking any argument and the return

101
00:06:33,720 --> 00:06:34,860
type will be void.

102
00:06:35,550 --> 00:06:38,760
Okay so best of luck guys.

103
00:06:38,820 --> 00:06:41,610
I hope you will be able to implement it very easily.

104
00:06:41,610 --> 00:06:42,270
Okay.

105
00:06:42,540 --> 00:06:42,960
Thank you.
