Bài Đang S A
Bài Đang S A
Bài Đang S A
import java.util.Scanner;
public class shape {
String color;
boolean filled;
double radius;
double Area;
double Perimeter;
public shape(String color,boolean filled,double radius, double Area,double
Perimeter) {
this.color = color;
this.filled = filled;
this.radius = radius;
this.Area = Area;
this.Perimeter = Perimeter;
}
public shape() {}
public void input() {
System.out.println("color:"+this.color+";filled:"+this.filled);
}
public String getcolor() {
return color;
}
public void setcolor(String color) {
this.color = color;
}
public boolean getfilled() {
return filled;
}
public void setfilled(boolean filled) {
this.filled = filled;
}
}
class circle extends shape{
double radius;
double Area;
double Perimeter;
String color;
boolean filled;
public circle() {}
public circle(double radius,double Area,double Perimeter) {}
public circle(double radius,String color,boolean filled,double Area,double
Perimeter) {}
public double getradius() {
return radius;
}
public void setradius(double radius) {
this.radius = radius;
}
public double getArea() {
return Area;
}
public void setArea(double Area) {
this.Area = Area;
}
}
}
class rectangle extends shape{
double width;
double length;
double Area;
double Perimeter;
public rectangle() {}
public rectangle(double width,double length,double Area,double Perimeter) {}
public rectangle(double width,double length,String color,boolean filled) {}
public double getwidth() {
return width;
}
public void setwidth(double width) {
this.width = width;
}
public double getlength() {
return length;
}
public void setlength(double length) {
this.length = length;
}
this.length = length;
}
public String toString() {
return color+""+filled+""+width+""+length;}
public void main(String[]args) {
double width = 1.0;
double length = 1.0;
double radius = 1.0;
Rectangle hcn = new Rectangle(double width ,double length);
Circle ht = new Circle(double radius);
Scanner scanner = new Scanner(System.in);
color: }
import java. util.Scanner;
public class color {
private String tenmau;
@Override
public String toString() {
this.tenmau = tenmau;
this.mamau = mamau;
}
public color () {
}
public String getTenmau() {
return tenmau;
}
public void setTenmau(String tenmau) {
this.tenmau = tenmau;
}
public int getMamau() {
return mamau;
}
public void setMamau(int mamau) {
this.mamau = mamau;
}
public void nhap() {
Scanner sc = new Scanner (System.in);
System.out.println("nhap tenmau");
this.tenmau = sc.nextLine();
System.out.println("nhap mamau");
this.mamau = sc.nextInt();
}
}
hcn.setwidth(scanner.nextDouble());
hcn.setlength(scanner.nextDouble());
ht.setradius(scanner.nextDouble());