afd / javatutorialquestions Goto Github PK
View Code? Open in Web Editor NEWTutorial Questions for the Programming II course at Imperial College London
License: Apache License 2.0
Tutorial Questions for the Programming II course at Imperial College London
License: Apache License 2.0
"Tutorial Questions for the C120.2 Programmig II course at Imperial College London"
In problem 2d33, a Deque
(via ArrayDeque
) was recommended for reversing the order of line inputs the user gives.
Would it not make more sense to directly use a Stack
instance (from java.util
, since Java 7), as the question wording even implies this:
and provides the functionality of a stack: push and pop operations
And mention Queue
s and Deque
s as an aside instead?
The second solution says
Make interfaces Detached
, SemiDetached
, and Terraced
. Keep Bungalow
as an abstract class that extends House
. Then have DetachedHouse
extend House
and implement Detached
, and have DetachedBungalow
extend Bungalow
and implement Detached
(the setup for the semi-detached and terraced property types is analogous). You might benefit from drawing a class diagram for this arrangement.
According to the solution above, TerracedBungalow
is extending an abstract class Bungalow
and implementing an interface Terraced
while TerracedHouse
is extending an abstract class House
and implementing an interface Terraced
.
Hence, TerracedBungalow
isn't an instance of TerracedHouse
while the question claims that TerracedBungalow
'is-a' TerracedHouse
(since it says that PropertyCollection
has 1020 terraced houses).
Hi Alastair,
I am just wondering when the questions about Java stream (as in TODO) will be posted?
Thank you!
Best wishes,
Leonard
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.