Java代写 | ippo 2021-2022 Assignment 1


1 The Application

For this assignment, you will be working with an application which displays images of the Munros.
These are the 282 highest mountain tops in Scotland and are named after Sir Hugh Munro who first
catalogued them. You can see the full list and hear the pronunciation of the Gaelic names on the Walk
Highlands2 web page (you will not be tested on the pronunciation).

The application itself is quite simple, but it will give you some realistic experience with:

  • Using “professional” development tools.
  • Creating applications by “composing”3 objects of different classes.
  • Understanding and using classes created by others, as well as the standard Java libraries.
  • Integrating these with your own code.
  • Working with remote services.
  • Working with graphical user interfaces.
  • Documenting and testing your code.

2 Preparation

Real Java applications are constructed from large collections of classes. And most of the code will usu-
ally be provided by other people – either by someone else working on the same (large) project, or as part
of a library or framework imported from elsewhere (such as the JavaFx graphics framework). To give
you a realistic experience for this assignment, we have provided a library containing some useful classes
for downloading and displaying images. You will be extending some of these, and writing new classes
which interact with them to produce an application for viewing photographs of the Munros.

[1] Before starting on the assignment, make sure that you have a working set of development tools
and understand how to use them. See LEARN Resources Course Notes DevelopmentTools.pdf .

You will need:

• A Java 17 SDK
• Java FX SDK 17
• Hamrest 2.2
• JUnit

[2] These JAR-files and libraries should be put into a folder in your solution. To help you get started,
we have provided some template files for the application.

The following illustrates the setup process:

1. Download LEARN Assessment Assignment 1 and unzip this template project.
2. Import the template into a new IntelliJ project.
3. Set the path to the FX modules in the project settings.
4. Define the libraries you are using.
5. Specify the modules to be loaded. The template you downloaded is set up for the sample
directories and has to be adjusted by you accordingly.
6. After loading the directory into IntelliJ and proper setup, your view should be similar to this:
7. After pressing run you should see an interface which allows you to view a selection of images,
similar to the one on the first page. Ask for help on Piazza if you have issues getting this to work.

Now that you have a clean template project, you are ready to start work on the assignment . . .

3 Understanding the Classes

The demonstration application is structured using three main classes:
• A View class which handles the interface (displaying the images, and detecting user input).
• A Service class which retrieves a picture from the remote service.
• A Controller class which manages the other classes and determines the overall behaviour of the

3.1 Using Different Implementations

A well-designed application will allow classes to be easily replaced with different implementations. To
illustrate this, our library provides:

  • Two different View implementations – using buttons or menus.
  • Two different Service implementations – Wikipedia and the IPPO photographs.
  • Two different Controller implementations – one which allows specific images to be viewed, and
    another which displays a random image and asks the use to guess the appropriate name (a “quiz”).

Notice that each of these (View, Service, Controller) has several implementations and an interface5
specification which defines the methods that each implementation must provide.
The library provides a mechanism for you to experiment easily with different combinations of these
implementations by changing values in a “property file”:

[3] Experiment with the different properties:

1. Open the project file src main resources properties . Lines starting with # are
explanatory comments which are ignored by the system.

2. Change the View from ButtonView to MenuView and re-run the application. Notice how the
interface has changed but the other components remain the same.

3. Change the Controller from SimpleController to QuizController. The application
will show a random Munro. You can guess the name and the application will tell you whether you
are correct or not. Choosing New will display another Munro.

4. Change the Service from IPPOService to WikiService (this example may be clearer if
you change back to the SimpleController) and re-run the application. The application will
fetch the images from Wikipedia, so there will be different images for each mountain (and there
will be a slower response).

5. Reset the property file back to the original values for the following exercises.



本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail:  微信:itcsdx