import java.io.*;
class rect
{
int width,length;
String color;
void set_length(int a)
{ length=a; }
void set_width(int a)
{ width=a; }
void set_color(String a)
{ color=a; }
int area()
{ return(width*length); }
String getcolor()
{ return(color); }
}
class s03_01
{
public static void main(String arg[])throws Exception
{
String s=null;
DataInputStream in=new DataInputStream(System.in);
rect a=new rect();
System.out.println("Enter the length for first rectangle");
s=in.readLine();
a.set_length(Integer.parseInt(s));
System.out.println("Enter the width for first rectangle");
s=in.readLine();
a.set_width(Integer.parseInt(s));
System.out.println("Enter the Color for first rectangle");
a.set_color(in.readLine());
rect b=new rect();
System.out.println("Enter the length for second rectangle");
s=in.readLine();
b.set_length(Integer.parseInt(s));
System.out.println("Enter the width for second rectangle");
s=in.readLine();
b.set_width(Integer.parseInt(s));
System.out.println("Enter the Color for second rectangle");
b.set_color(in.readLine());
if(a.area()==b.area() && a.getcolor().equals(b.getcolor()))
System.out.println("Matching Rectangle ");
else
System.out.println("Non Matching Rectangle ");
}
}
class rect
{
int width,length;
String color;
void set_length(int a)
{ length=a; }
void set_width(int a)
{ width=a; }
void set_color(String a)
{ color=a; }
int area()
{ return(width*length); }
String getcolor()
{ return(color); }
}
class s03_01
{
public static void main(String arg[])throws Exception
{
String s=null;
DataInputStream in=new DataInputStream(System.in);
rect a=new rect();
System.out.println("Enter the length for first rectangle");
s=in.readLine();
a.set_length(Integer.parseInt(s));
System.out.println("Enter the width for first rectangle");
s=in.readLine();
a.set_width(Integer.parseInt(s));
System.out.println("Enter the Color for first rectangle");
a.set_color(in.readLine());
rect b=new rect();
System.out.println("Enter the length for second rectangle");
s=in.readLine();
b.set_length(Integer.parseInt(s));
System.out.println("Enter the width for second rectangle");
s=in.readLine();
b.set_width(Integer.parseInt(s));
System.out.println("Enter the Color for second rectangle");
b.set_color(in.readLine());
if(a.area()==b.area() && a.getcolor().equals(b.getcolor()))
System.out.println("Matching Rectangle ");
else
System.out.println("Non Matching Rectangle ");
}
}
No comments:
Post a Comment