|
本帖最后由 51黑bing 于 2016-3-22 20:10 編輯

public class Human
{
public Human(String name, String sex, float height, float money, boolean handsome, boolean beautiful)
{
this.name = name;
this.sex = sex;
this.height = height;
this.money = money;
this.handsome = handsome;
}
public boolean ifTallRichHandsomeOrBeautiful()
{
if (sex.equals("man"))
{
if (height >= 1.70f && money >= 10000f && handsome)
{
System.out.println("高富帥!!\n\n");
return true;
}
else
{
System.out.println("靜下心來,好好想一下未來的路,相信你一定會成功!!\n\n");
return false;
}
}
else if (sex.equals("woman"))
{
if (height >= 1.70f && money >= 10000f && beautiful)
{
System.out.println("白富美!!\n\n");
return true;
}
else
{
System.out.println("靜下心來,好好想一下未來的路,相信你一定會成功!!\n\n");
return false;
}
}
else
{
System.out.println("我是基的。。。\n\n");
return false;
}
}
public String name;
private String sex;
private float height;
private float money;
private boolean beautiful;
private boolean handsome;
}
-------------------------------------------------------------------------------------------------------------------------------------------------
public class Test
{
public static void main(String args[])
{
Human nanmei = new Human("楠妹", "woman", 1.70f, 5000f, true, false);
System.out.println("我的名字是:" + nanmei.name + "\n" + ",哈!");
nanmei.ifTallRichHandsomeOrBeautiful();
int x = 0, y = 0;
double result = 0, m = 0, n = 0, j = 0, k = 0;
int[][] a = new int[80][30];
for (y = 0; y < 30; ++y)
{
for (x = 0; x < 80; ++x)
{
if (y <= 7 & x <= 40)
{
j = (7.0 - y) / 6.0;
k = (40.0 - x) / 16.0 - 1;
m = Math.pow(j, 2);
n = Math.pow(k, 2);
result = m + n;
if (result > 1)
{
a[x][y] = 1;
}
else
{
a[x][y] = 0;
}
}
if (y <= 7 & x > 40)
{
j = (7.0 - y) / 6.0;
k = (x - 40.0) / 16.0 - 1;
m = Math.pow(j, 2);
n = Math.pow(k, 2);
result = m + n;
if (result > 1)
{
a[x][y] = 1;
}
else
{
a[x][y] = 0;
}
}
if (y > 7 & x <= 40)
{
j = (7.0 - y) / 18.0;
k = (40.0 - x) / 32.0;
m = Math.pow(j, 2);
n = Math.pow(k, 0.5);
result = m + n;
if (result > 1)
{
a[x][y] = 1;
}
else
{
a[x][y] = 0;
}
}
if (y > 7 & x > 40)
{
j = (7.0 - y) / 18.0;
k = (x - 40.0) / 32.0;
m = Math.pow(j, 2);
n = Math.pow(k, 0.5);
result = m + n;
if (result > 1)
{
a[x][y] = 1;
}
else
{
a[x][y] = 0;
}
}
}
}
for (y = 0; y < 25; ++y)
{
for (x = 0; x < 80; ++x)
{
System.out.print(a[x][y]);
}
}
}
}
|
|