Assignment 1: Input, Variables and Expressions, Drawing.
Introduction to Computer Program Design: Assignment 1
Due 22 Sep 7pm This is a Pass/Fail (P/F) AssignmentGoals
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
Resources and links
- Online Part: Online questions
- Programming part:
- Download Zip file
- Submit your java files.
- Marks and Feedback.
- Java Documentation
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. Go to the Online questions now and answer all the Assignment 1 questions.
Programming part
To Submit:
- Your java program:
FlagDrawer.java
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
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.)
- 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
, orUI.drawString
methods! - You must use the
TOP
andLEFT
constants. - Details for each symbol can be found in the comments above the relevant methods in the code.
- You can use
Color.green.darker()
to use a darker green. - You can use
fillArc
to draw parts of circles. - The sizes are in pixels. Do not test your methods with sizes that are below 100. Test each method with various sizes.
- The flag of Benin
- The flag of Greenland
- The Czech flag.
fillArc
method from the UI library to draw the Czech flag.
Benin: | |
---|---|
instructions Image downloaded from https://en.m.wikipedia.org/wiki/File:Flag_of_Benin_%28construction_sheet%29.svg | |
Greenland: | |
instructions Image downloaded from https://commons.wikimedia.org/wiki/File:Flag_of_Greenland_Proportion.svg | |
Czech Republic: | |
instructions |
FlagDrawer: Challenge level
Write methods for:- The Mitsubishi logo: You must use the fillArc method from the UI library to draw the Mitsubishi logo.
- The "Unity Koru" flag, designed by Sven Baker for the New Zealand flag referendum.
Mitsubishi: | |
---|---|
Koru: |