Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please program this in Java using very simple shapes and colors? part 1 part 2 sS Your init() method should do the following

Can someone please program this in Java using very simple shapes and colors? image text in transcribedpart 1
image text in transcribedpart 2
sS Your init() method should do the following things in this order: 1 A user of your program should be greeted with a message dialog window (not on the console output window or an input dialog window)that introduces the program and asks the user to decide some details of the logo. The starter file shows an example of a similar exchange in which the user is asked how many trees to draw. Your program should ask something different. For example, you may ask if one of the items in the logo should be red or purple. 2 2. After the user has responded, your program should ask a second question about some other detail of the logo. 3 3. After receiving input from each of the dialog windows, the program should verify that the string entered by the user is a valid response. For example, if the user typed in "green" instead of "red" or "purple" in the example above, your program should display a dialog window message stating that the input was invalid, and the program is setting the value to a default value. For example, the program might say, "That is an invalid response. The default, 'red', will be used." 4. 4. Each time the user answers a question, you should save the user's response as an instance variable so that other methods in your program will be able to use it later. Recall that an instance variable is declared in the Logo class, but outside any of the methods. 5. 5. Any given dialog should only appear once each time the program runs. It should not reappear when the window is resized. paint() method Your paint() method should be implemented as follows: 1 Your paint() method should display the logo in the window for the user. 2 2. Your logo should use at least three colors. Regardless of the user's input, the drawing should always have at least three distinct colors. The details of the logo should reflect the choices that the user made. 4. 4. The elements of the drawing should be recognizable. I don't expect professional graphics, but I should be able to identify the various objects depicted. 55. Make sure your logo has a title that is drawn using the drawString() method. 3 Second Helper Method. You should implement a helper method that draws a particular element of your logo at a given location. 1. Create a method that, when given a Graphics object and x and y coordinates (as two ints), draws a particular element of the logo at the given position. You are welcome to write your method so that it requires additional arguments such as a size and/or color. The starter file shows an example of a method to draw a tree. Your program should do something different 2. It should be possible to run your program so that your paint() method calls your helper method at least twice with different arguments. It's ok if some user input will cause the method to only be called once or not at all, as long as some user inputs will create two or more calls to your helper method. Please avoid any elements in your logo that are likely to be offensive to others

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_2

Step: 3

blur-text-image_3

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

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions