Thanks to Emily Feng for this link to a Ted Talk about flag design.
Here is the one I created:
But I am certain you will be much more creative!
Warning The book is missing some of the functionality that is in the Sedgewick library. For example, the book is missing the method that draws a filled rectangle, and that can be useful for drawing a flag.
See the link above for the full range of possibilities.
Design (or pick) a flag that has at least 3 shapes on it. If you need to approximate something by a standard shape, such as a maple leaf by a circle, that's fine: just claim that your flag is somewhat abstract.
If you want to design your own flag, that's fine. Make sure it has at least 3 shapes in it. Try to come up with a cool name for your flag's country.
- Most of the drawing methods want the center of the object to be drawn, along with a radius, or a half-width, or a half-height. Be aware of this!
- If you want colors, they are already in the Sedgewick libraries. If you start to type something like:sedgewick.then eclipse will fill in possiblities after the . which will include the colors at the top of that list.
For more drama, pause for a bit between each printing of the country's name, to allow for cheering from the crowd. Take a look at the show(int t) method to achieve the pause.
The music inputs come from the music folder in your workspace. The program lets you choose any of the files in that directory, or you can navigate elsewhere if you wish.
You can do this by modifying an existing file in the music folder (for example, there is already a National_Anthem.txt file, so you can just modify that), or you can create a new text file in that same folder and place your composition there.
If you are really unclear how to do this, no problem, you can just use one of the existing compositions.
Or, you could generate tones and durations randomly. Pick values that seem similar to what you see in the music files.
- The code you want is everything inside the main method; get help if necessary.
- When you run your code, you will have to select the anthem by hand.
- If you want the file to open without the user having to choose it, then replace the lineArgsProcessor.useStdInput("music");withSystem.setIn(new FileInputStream("music/National_Anthem.txt"));Eclipse will provide guidance about importing the right classes so this will work.
This may not seem easy, but it builds on what you know about arrays and iteration.
When you done with this studio, you must be cleared by the TA to receive credit.
- Commit and push all your work to your repository
- Fill in the form below with the relevant information
- Have a TA check your work
- The TA should check your work and then fill in his or her name
- Click OK while the TA watches
- If you request propagation, it does not happen immediately, but should be posted in the next day or so
This demo box is for studio 4