Please write the code with the passion and effort. Low quality code is not acceptable. Please use the same approach.
Please write the code neat and tidy and before committing, please check if there are unnecessary files. Always keep the project neat and tidy.
-
ImplementTransaction.java
-
Initiate some constants inside Constant.java for reimbursement rate for demolishing. -
Implement transaction insidebuildRoad(), assignZone(), constructBuilding() and other demolishMethods
. -
When initiating zones, population has to be random, in case of ServiceIndustrial, the number of employee quota has to be random as well. -
CompleteassignZone()
inside City.java -
ImplementgetTrasactionList()
inside City.java using Bank attribute. -
ImplementgetPopulation()
which will compute usingList<Zone>zones
(City.java). -
ImplementgetFreeWorkspace()
which will return the difference between number of employees (calculate it fromList<Zone>zones
) and population. (here if the result is negative, then no freeworkspace, so, zero, 0) (City.java). -
ImplementgetJoblessPopulation()
which will return the difference between number of employees and population, (here if the result is positive, then no jobless people, so zero:0) (City.java). -
ImplementBuilding.java
and its respective children, Power Plant, Stadium, Police Department. Every building has its radius which will affect the satisfaction of the people. The radius can be constant for all buildings. (City.java) -
Implement
getSatisfaction()
which will calculate based on the jobless population, electricity, stadium, police department. The simple algorithm is that first, get the satisfaction of each residence by iterating through all the residential zones and checking if there are police dept, power plant, stadium within the radius, if those exist, then do arithmetic calculation with jobless/employed population. Calculate overall satisfaction using basic arithmetic. (If you have a better idea, you can use it). (This function need very good performance) (City.java) -
Implement
collectTax()
which will add the specific values to the bank obtained by calculating through employed population. -
Implement
payPension()
which will subtract the specific values based on datetime and unemployed population. (do it yourself). -
Implement
spendMaintenanceFee()
which will subtract the specific values calculated based on road, police department, etc. -
ImplementgetDateString() which will parse the
second:int` into 'DD-MM-YYYY HH:mm' string. (This function needs very good performance) -
ImplementincreaseTime(int) which will add it to the
second:int` attribute. -
Implement the transmissionLine similar to Road.
-
ImplementTransactionPanel.java
which contains the table. -
Connect it with theStatisticPanel
-
Addtimer
to refresh thestatisticPanel
insideMainWindow
-
refreshStatistic()
method to refresh all the statistics. -
2x button inside StatisticPanel to control speed of the game
-
Replace the button in MenuPanel with a .png graphic as an icon. -
Write the Dialog box that extendsJComponent
. Redirect to the Dialog box if theNew Game
Button is clicked (CheckActionListener
ofMenuButton
). When the Dialog box is confirmed (Check theActionListener
of Dialog box), the CityMap page appeared
[no backend yet now, will have to implement later, after database implementation]. (Mohamed) -
Create a new button insideStatisticPanel
, which is aBack to Menu
button (for now, just a text button, later replaced with an icon) which will save the current game and go back to the Menu Page (implementActionListener
(mouseClicked()
) for this button) (Mohamed) -
Create a custom panel that extendsJPanel
, which is named,LoadGamePanel
, and implement it as you wish. (TheLoadGamePanel
page has a list with a vertical scroll bar; which will read the saved game list and show it inside the Panel. There will be 2 Buttons that operate CRUD (for this, only Read and Delete).
[Will improve the design later by overriding the paintComponent method]. (Dominykas) -
AddActionListener
(mouseClicked()
) for Quit Button, which will quit everything. (Mohamed) -
Create a Delete Button inside theInGameButtonPanel
of theCityMap
Page, which will delete the elements that are clicked inside the CityMap Panel. [Later ask for confirmation with Dialog]. (Zaw Moe) -
Create aStatisticLabel
class that extendsJLabel
. Every label insideStatisticPanel
will be the same typeStatisticLabel
(Third MileStone) -
Use theTimer
to render the vehicle on the road (The track of the road can be checked atcity.cells[][]
)) (Zayar)
-
Implement theisOccupied()
method insideCity
Class, which takesPosition p
and checks if that cell is occupied or not (in other words, checking if theCellItem
isGENERAL
or not) (Dominykas) -
ImplementDatabase
class which handles the JSON files, and minimumCRUD
has to be implemented. Design the JSON Structure.Database
class will have to work only withCity
Class. (Dominykas) -
Implement theconstructBuilding(Position p; CellItem ct)
method, which will assign theCellItem.BUILDING
to thecells[][]
withp
and it is not enough to set only 1 cell, you have to assign according to theCellItem.BUILDING.tiles
. The given parameter p represents the top left cell. And the last thing is to create a newBuilding
Object, assign respective attributes, and store it inside buildings (ArrayList
). [Later, we will implement the satisfaction] (Dominykas) -
ImplementdeleteRoad(Position p)
which will delete from thecells[][]
(changing back toCellItem.GENERAL
) and remove it from roads (ArrayList). (Zaw Moe) -
ImplementdeleteBuilding (Position p)
which will go linear search through thebuildings
ArrayList, (useIterator()
) and find if the givenp
is inside that building location (inside theBuilding
Class, there is already storedList<Position>
attributes which were assigned insideconstructBuilding()
). Once you find the respectiveBuilding
, then first, you remove thatCellItem.BUILDING
from cells, with the help ofBuilding.location
(ArrayList
) [just reassign theCellItem.GENERAL
]. After that, you can use the.remove()
method ofiterator
to remove that Building from the buildings list. The above logic has to be done insideIteration
. (Zaw Moe) -
~~
assignZone(Position p, CellItem ct)
methods which will assign the givenct
into thecells[][]
atp
. And Create a new Zone object according to theCellItem
and add it to the zones List.
[Later, we will implement the cost, and population inside Zone class and we will calculate it accordingly] (Mohamed) -
create a time mechanism (probably as int), which we could use. To follow time, speed up the game and so forth. For example increase +1 if normal time, by 2 if doble speed, end day at 3600. (Zaw Moe)~~
- Override the
paintComponent
ofInGameButtonPanel
andStatisticPanel
- obtain the graphic
.png
file first. - add a new CellItem and add a (CellItem,Graphic) pair into
CityMap.graphics
- Create a new
InGameButton
object insideInGameButtonPanel
and use respective graphic and image path. - Rendering can be done inside
paintComponent(Graphic)
method ofCityMap
class. The idea for render is that the larger element should rendered at the last step of the method. - Read the below docs.
This method is a canvas method which will paint/draw the surface of the JPanel.
It has drawn with the coordinate point, top-left represents origin (0,0).
It is just like a normal drawing on your paper. You can also draw the image on it (here we used image)
It is rendered with this method
gr.drawImage(img, j*tile_size, i*tile_size, tile_size, tile_size, null );
drawImage(Image, X:int, Y:int, width:int, height:int, null)
.
X and Y represent the top-left corner of the drawing. You can call this drawImage
method as much as you want and you just need to provide what to draw, where to draw and the dimension to draw.
As you see this method will render the base which is cells[][] matrix of the model.
So, the GENERAL
, RESIDENTIAL
, SERVICE_INDUSTRIAL
, ROAD
, TRANSMISSION_LINE
are painted first.
After that, all the Buildings will be painted because buildings has larger tiles 2x2.
At the last, animation and event will be painted.