Question
I don't know how to solve these problem2~problem6 I put BlueDot code in last part. Could you solve these problems? Problem 2: Pump It Up!
I don't know how to solve these problem2~problem6
I put BlueDot code in last part.
Could you solve these problems?
Problem 2: Pump It Up!
In the context of the NPW, write a program called PumpItUp within the npw package to paint an image of the Pump It Up dance floor, much like the one depicted below.
Constraints:
- Use the technique of modifying an existing program that does something similar. Do so by: (a) Creating a new Java Main Class file for the program, naming it PumpItUp and placing it in the npw package. (b) Replacing the entire contents of the PumpItUp file with the entire contents of the BlueDot program. (c) Changing all occurrences of BlueDot to PumpItUp.
- Place the following code, without alteration, in the paintTheImage method.
1
2
3
4
5
6
SPainter painter = new SPainter("Pump It Up",600,600);
SSquare square = new SSquare(150);
paintYellowSquare(painter,square);
paintRedSquares(painter,square);
paintBlueSquares(painter,square);
paintGraySquares(painter,square);
- One at a time, complete the definitions of the methods, proceeding as follows: (a) Run the program, and see that not much happens. (b) Refine the paintYellowSquare method, run the program, enjoy the yellow square. (c) Refine the paintRedSquares method, being sure to make it invariant with respect to both the location and heading of the painter, run the program, enjoy the yellow square and the red squares. (d) Refine the paintBlueSquares method, being sure to make it invariant with respect to both the location and heading of the painter, run the program, enjoy the yellow square and the red squares and the blue squares. (e) Refine the paintGraySquares method, being sure to make it invariant with respect to both the location and heading of the painter, run the program, and enjoy looking at the dance floor!
Problem 3: Dots
In the context of the NPW, write a program called Dots within the npw package to paint an image consisting exclusively of dots (painted circles) subject to the following constraints:
- it contains exactly 9 painted (filled in) circles
- it contains circles of exactly 4 different sizes
- it contains circles of exactly 4 different colors
- none of the circles touch
- the image is symmetric about the Y-axis
- not all of the circles touch the Y-axis
Problem 4: Two Figure Minuet Thing
In the context of the MMW, write a program called TwoFigureMinuetThing within the mmw package to play the exact same sequence of ten notes that is played by the following program, subject to the constraint that you may not use any SComposer objects. Thus, you will have to write the program using only an SNote object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * Ten note line created by joining two JSB minuet figures. */ package mmw; import composer.SComposer;
public class TwoFigureMinuetThing { public static void main(String[] args) { SComposer sc = new SComposer(); sc.text(); sc.mms_35_JSB_M9(); sc.mms_35_JSB_M13(); } } |
Problem 5: Landscape and Motion Sequence Viewer
In the context of the MMW, write a program called LandscapeAndMotionListener within the mmw package to simply play each of the melodic sequences related to landscapes (e.g., hills) and motion (e.g., strolling) that are listed in the back of your lab manual and available in the MMW, in such a way that they are textually displayed. Do so by using Task 4 of Lab 2 as a model. That is, work by explicit analogy with the program featured in that task.
Problem 6: Hilly Journey
Write a program called HillyJourney within the mmw package to play a melody composed exclusively of the figures available in MMW which relate to landscapes and motion, subject to the following additional constraints:
- The melody will consist of between 40 and 45 notes.
- The melody will make use of exactly 6 different modular melodic sequences, all related to either motion or landscapes.
- At least one sequence will be related to hills, and at least one will be from the sequences related to motion.
- The final note will be a long C note
-
/***************************************************** *** PROGRAM TO PAINT A BLUE DOT IN THE CONTEXT OF *** *** THE NONREPRESENTATIONAL PAINTING WORLD, NPW ***** *****************************************************/ package npw; import java.awt.Color; import javax.swing.SwingUtilities; import painter.SPainter; import shapes.SCircle; public class BlueDot { /**SOLUTION**/ private void paintTheImage () { SPainter klee = new SPainter("Blue Dot", 600, 600); SCircle dot = new SCircle(200); klee.setColor(Color.BLUE); klee.paint(dot); } /**REQUIRED INFRASTRUCTURE**/ public BlueDot() { paintTheImage(); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new BlueDot(); } }); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started