Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

Constraints:

  1. 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.
  2. 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);

    Then: (a) Use IntelliJs hints to add necessary import statements. (b) Use the light bulbs to create a stub for each of the unrefined program. (You should create 4 stubs.)
  3. 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:

  1. it contains exactly 9 painted (filled in) circles
  2. it contains circles of exactly 4 different sizes
  3. it contains circles of exactly 4 different colors
  4. none of the circles touch
  5. the image is symmetric about the Y-axis
  6. 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:

  1. The melody will consist of between 40 and 45 notes.
  2. The melody will make use of exactly 6 different modular melodic sequences, all related to either motion or landscapes.
  3. At least one sequence will be related to hills, and at least one will be from the sequences related to motion.
  4. The final note will be a long C note
  5. /***************************************************** *** 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(); } }); } }
Pump It Up Pump It Up

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

2. How were various roles filled?

Answered: 1 week ago