Assignment 1: Input, Variables and Expressions, Drawing.

Introduction to Computer Program Design: Assignment 1

days Due 22 Sep 7pm

ALERT! This is a Pass/Fail (P/F) Assignment

Goals

The goal of this assignment is for you to be able to construct programs in Java that
  • use methods to get simple user input
  • use variables for storing values, and expressions for computing values
  • use methods for drawing

Online part

Start with the online part as it will help you consolidate your knowledge for the programming part.

This part is compulsory and you must pass all the online questions related to this assignment by the deadline to pass this assignment.
The Challenge questions are optional but would help your learning.

right Go to the Online questions now and answer all the Assignment 1 questions.

Programming part

To Submit:

  • Your java program: FlagDrawer.java

ALERT! Do not rename this file. You must use the provided template file and not remove the setupGui and main methods.

When you have submitted this file, check that you can read the file listed on the submission page, and complete the submission process.

Zip file

FlagDrawer: Pass level

ALERT! You must complete this part even if you want to do the Challenge level.

Assumptions:
  • The exact colours of the symbols will be difficult to match; It is fine to use the standard colours: red, green, blue, orange, etc. (See the Java Documentation on Color to find out what standard colors are available, but you can use more accurate colours if you wish.)

Instructions and Tips
  • Images of the symbols required in this assignment are available in the Assig1 folder you downloaded.
  • You can find lots of details, including the correct dimensions and colours, of flags from http://www.crwflags.com/fotw/flags/
  • You may not use the UI.drawImage, or UI.drawString methods!
  • You must use the TOP and LEFT constants.
  • Details for each symbol can be found in the comments above the relevant methods in the code.
  • tip You can use Color.green.darker() to use a darker green.
  • tip You can use fillArc to draw parts of circles.
  • tip The sizes are in pixels. Do not test your methods with sizes that are below 100. Test each method with various sizes.

Write methods to draw:
  • The flag of Benin
  • The flag of Greenland
  • The Czech flag.

You must use the fillArc method from the UI library to draw the Czech flag.

Benin: benin.png
instructions Image downloaded from https://en.m.wikipedia.org/wiki/File:Flag_of_Benin_%28construction_sheet%29.svg The flag of Benin
Greenland: The flag of Greenland
instructions Image downloaded from https://commons.wikimedia.org/wiki/File:Flag_of_Greenland_Proportion.svg Greenland flag
Czech Republic: Czech flag
instructions Czech flag

FlagDrawer: Challenge level

Write methods for:

Mitsubishi: mitsubishi.png
Koru: unity-koru.jpeg