내 프로그램을 단순화하려고 시도했습니다. 다른 클래스의 추가 및 제거 방법을 테스트하고 내가 붙어있는 배열 목록의 속성 목록을 인쇄하기 위해이 테스터를 만들려고합니다.배열 및 인쇄에 항목을 계속 추가하는 방법
을 진행하는 방법 (어떤 이름의 ArrayList를 가지고 여기
public class Tester
{
public static void main (String[] args)
{
}
public Tester()
{
Apartment testingApartment = new Apartment();
Basement testingBasement = new Basement();
Company testingCompany = new Company();// Contains list of
// properties to sell
// in arraylist
// elements with a 2 after the name are used for the Basement
// elements
String Apartmentneighbourhood = "Parkdale";
String Basementneighbourhood = "Rexdale";
double price = 400000.99;
double price2 = 5000000.99;
int numberofbaths = 3;
int numberofbaths2 = 5;
int numberofbedrooms = 2;
int numberofbedrooms2 = 4;
int squarefoot = 3000;
int squarefoot2 = 5000;
int floors = 4;
int floorlevel = 4;
testingApartment.setneighbourhood(apartmentneighbourhood);
testingBasement.setneighbourhood(Basementneighbourhood);
testingApartment.setprice(price);
testingBasement.setprice(price2);
testingApartment.setbathNum(numberofbaths);
testingBasement.setbathNum(numberofbaths2);
testingApartment.setbedNum(numberofbedrooms);
testingBasement.setbedNum(numberofbedrooms2);
testingApartment.setsqrft(squarefoot);
testingBasement.setsqrft(squarefoot2);
testingApartment.setNumFloors(floors);
testingBasement.setFloorLevel(floorlevel);
}
}
이 아파트의 목록을 가정 내 아파트 클래스
public void addApartment(Apartment newApartment)
{
Apartment ApartmentInput = new Apartment();
ApartmentInput = newApartment;
Arraylist.add(ApartmentInput);
}
코드가 아직 컴파일되지 않았다고 생각합니다. 주된 방법을보고있었습니다. 아직 완성되지 않은 것 같습니다. 편집 할 수 있습니까? – DreadHeadedDeveloper
훨씬 좋았어, 고마워, 나에게 몇 분만 주렴. 내가 나중에 뭔가를 가지고있을거야. 지금 바빠. – DreadHeadedDeveloper
편집 가능한 코드를 게시 할 수 있습니까? – m0skit0