Assignment 1
Assignment 1
*;
class Complex
{
float real;
float img;
Complex()
{
real=0; // default constructor
img=0;
}
Complex(float r,float i)
{
real=r;
img=i;
}
while(true)
{
System.out.println(" Enter choice for\n 1. Addition
\n 2. Sub \n 3. Mult \n 4. Div \n 5. For exit");
int ch;
ch=sc.nextInt();
switch(ch)
{
case 1:
c3.addition(c1,c2);
break;
case 2:
c3.subtraction(c1,c2);
break;
case 3:
c3.multiplication(c1,c2);
break;
case 4:
c3.division(c1,c2);
break;
case 5:
System.exit(0);
default:
System.out.println("Enter proper choice");