Due: April 13, Wednesday, 10:30 am.
Language: Java
Submission:
Consider this scenario: There is a school festival. In this school festival there are many schools. And each school has many stands. Students sell small items in these stands. The code that will be provided to you simulates a very small portion of this scenario: It displays stands of a school along with information about the stands.
public class Stand {
private String standName;
private String itemSold;
private double itemPrice;
public Stand(String standName, String itemSold, double itemPrice) {
this.standName = standName;
this.itemSold = itemSold;
this.itemPrice = itemPrice;
}
public String getStandName() {
return standName;
}
@Override
public String toString() {
return "Sells " + itemSold + " with price " + itemPrice;
}
}
public class School {
private String name;
private ArrayList<Stand> stands;
public School(String name) {
this.name = name;
this.stands = new ArrayList<Stand>();
}
public void addStand(Stand stand) {
stands.add(stand);
}
public String getName() {
return name;
}
}
Here is how the code provided to you will look like:
This is how it should look like when you’re finished with it: