The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 305 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Dear tutor,
There are a set of Object-Oriented related questions that should be implemented on this project(based on Java). Classes are provided in the src folder since it is an exported Eclipse project. The instructions are as follow:
First Level
A grid represents a field, have the cells drawn in different colours to represent the different surfaces that could be present. You should show four (4) different surfaces: brown dirt, light green grass, dark green trees and grey rocks. You can use just a single colour in the cell, you don't need to make it look like that surface. Each cell should be randomly assigned a surface upon its creation (constructor call).You may not change the signature of the Cell constructor from public Cell(int x, int y, int size)Â public Cell(int x, int y). This restriction means you will have to decide the surface type within the Cell constructor.
Second Level
Note: Put the first level code into a separate class called PassCell. That class won't be used but must not prevent compilation (i.e. it needs to compile but not run).
Instead of using the private field in the Cell class, make surface sub-class of Cell with an overridden paint method. This means you make four new classes, each of which will extend Cell. You won't be able to decide on the type of a cell in the Cell constructor anymore because you won't ever construct a Cell anymore, only one of the subclasses. Thus, you will need to find another place to make this decision
Third level
Is the second level solution better or worse than the first level solution? Why? Please explain the reasons completely well with examples from the code.
Attachments:
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly