Hello, I am a student that is unlucky to do the project by myself, please help!
Something of this is allready solved
The problem:
Class Square (game)
squares with such properties:
temperature : from -200 to 5000 C
cold damage 1 p. per 10 degrees below -5C
heat damage 1 p. per 15 degrees above +35C
humidity in percentage
rust damage: 1 p. per 7% humidity above 30%¨
slippery in following conditions:
a) humidity-100%, temperature>0
b) temperature <0, humidity>10%
c) made of slippery material
degree of inhabitability:can be presented as a function of heat and cold damage and humidity
borders: every square can border to another in 6 possible directions
addition: two squares that borders to each other can be added:
-new humidity -average of two old humidities
-new temperature -weighted average (formule)=
((c1*humidity1+c2)*temp1+(c1*humidity2+c2)*temp2)* 1/2,
c2- random const from 0,1 to 0,4
c1 can be found from:
c1*humidity1+c1*humidity2+2*c2=2
constructors have to create new squares with ä definite temperature and humidity.
Also standard squares can be created.
SQUARE 1:
-temperature 150C
-humidity 59,01%
-slippery
borders 1,2,3
SQUARE 2:
--temperature 40C
-humidity 89,90%
-not slippery
borders 2,3,4
Add these two squares.
Solved:
temperature : from -200 to 5000 C
cold damage 1 p. per 10 degrees below -5C
heat damage 1 p. per 15 degrees above +35C
humidity in percentage
rust damage: 1 p. per 7% humidity above 30%¨
constructor
the code for the solved part is as follows:
Please help, what do I do with the borders and the addition of the squares? I don't manage to solve it to the deadline myself...package help; /** * * @author LB */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Place MyPlatform = new Platform(150, 100); System.out.println(MyPlatform.getHotDamage()); System.out.println(MyPlatform.getRust()); } } interface Place{ void setTemperature(int count); int getColdDamage(); int getHotDamage(); void setHumidity(int count); //Humidity int getRust(); //Rust } final class Platform implements Place{ private int Temperature; private int Humidity; Platform(int T, int H){ Temperature = T; Humidity = H; } public void setTemperature(int count) { Temperature = count; } public int getColdDamage() { if (Temperature < -5){ return (Temperature + 5) / 10; } else return 0; } public int getHotDamage() { if (Temperature > 35){ return (Temperature - 35) / 15; } else return 0; } public void setHumidity(int count) { Humidity = count; } public int getRust() { if (Humidity > 30){ return (Humidity - 30) / 7; } else return 0; } }