Java: An Introduction to Problem Solving and Programming (8th Edition)
8th Edition
ISBN: 9780134462035
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 4, Problem 14PP
Program Plan Intro
Evenly spaced circles
Program plan:
- Include necessary header files.
- Declare the class “EvenlySpacedCircles” that extends application class.
- Declare required constant variables.
- Define the “main()” function.
- Launch the application.
- Override the “start ()” method.
- Create a group, scene, canvas and graphics context.
- Set the values for “x_Center”, “y_Center”, and “radius”.
- Loop from 0 through total number of circles.
- Switch to the case (i % 3).
- If the value is 0,
- Draw a stroke in black color and fill the color with blue.
- Break the case.
- If the value is 1,
- Draw a stroke in black color and fill the color with red.
- Break the case.
- If the value is 2,
- Draw a stroke in black color and fill the color with green.
- Break the case.
- Draw a circle.
- Update the value of “x”.
- Switch to the case (i % 3).
- Add the canvas.
- Set the title.
- Add the scene to the stage and display it.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Create a Python app based on the given image.
Computer Science
IN PYTHON(visual studio code) program a simple flag that consists of at least two shapes while only using rectangles and circles. Give it a flagpole by drawing a long skinny rectangle next to it. Wave the flag by animating it up and down. (make the Swedish and UK flag)
import pgzero
Do this in JAVA Programming
Chapter 4 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Ch. 4.1 - What output is produced by the following code? int...Ch. 4.1 - Can the body of a while loop execute zero times?...Ch. 4.1 - What output is produced by the following code? int...Ch. 4.1 - Revise the following code so that it uses a while...Ch. 4.1 - What output is produced by the following code? int...Ch. 4.1 - Imagine a program that reads the population of a...Ch. 4.1 - Prob. 7STQCh. 4.1 - What output is produced by the following code? int...Ch. 4.1 - What output is produced by the following code? for...Ch. 4.1 - What output is produced by the following code? for...
Ch. 4.1 - Prob. 11STQCh. 4.1 - Write a for statement that displays the even...Ch. 4.1 - Prob. 13STQCh. 4.2 - Write a Java loop that will display the phrase One...Ch. 4.2 - Write a Java loop that will set the variable...Ch. 4.2 - Write a Java loop that will read a list of numbers...Ch. 4.2 - What output is produced by the following code? for...Ch. 4.2 - What output is produced by the following code? for...Ch. 4.2 - What output is produced by the following code? for...Ch. 4.2 - Revise the loop shown in Listing 4.6 to use a...Ch. 4.2 - What is the bug in the code in the section Tracing...Ch. 4.2 - Add some suitable output statements to the...Ch. 4.2 - What is the bug in the code in the previous...Ch. 4.2 - Prob. 24STQCh. 4.2 - Suppose that you did not have assertion checking...Ch. 4.3 - Prob. 26STQCh. 4 - Write a fragment of code that will read words from...Ch. 4 - Develop an algorithm for computing the...Ch. 4 - Develop an algorithm for a simple game of guessing...Ch. 4 - Write a fragment of code that will compute the sum...Ch. 4 - Convert the following code so that it uses nested...Ch. 4 - Write a for statement to compute the sum 1 + 22 +...Ch. 4 - (Optional) Repeat the previous question, but use...Ch. 4 - Write a loop that will count the number of blank...Ch. 4 - Write a loop that will create a new string that is...Ch. 4 - Write a program that will compute statistics for...Ch. 4 - Suppose we attend a party. To be sociable, we will...Ch. 4 - Define an enumeration for each of the months in...Ch. 4 - Write a fragment of code that computes the final...Ch. 4 - Suppose that you work for a beverage company. The...Ch. 4 - Suppose that we want to compute the geometric mean...Ch. 4 - Prob. 16ECh. 4 - Create an applet that draws a pattern of circles...Ch. 4 - Prob. 18ECh. 4 - What does the following fragment of code display?...Ch. 4 - Repeat Practice Program 4 of Chapter 3, but use a...Ch. 4 - Write a program that implements your algorithm...Ch. 4 - Repeat Practice Program 5 of Chapter 3, but use a...Ch. 4 - Write a program to read a list of nonnegative...Ch. 4 - Write a program to read a list of exam scores...Ch. 4 - Combine the programs from Programming Projects 5...Ch. 4 - Write a program that simulates the Magic 8 Ball...Ch. 4 - Whats for dinner? Let the computer decide. Write a...Ch. 4 - Write a program that implements your algorithm...Ch. 4 - Prob. 2PPCh. 4 - Write a program that reads a bank account balance...Ch. 4 - Modify Programming Project 5 from Chapter 2 to...Ch. 4 - Write a program that asks the user to enter the...Ch. 4 - Write a program that simulates a bouncing ball by...Ch. 4 - You have three identical prizes to give away and a...Ch. 4 - Prob. 9PPCh. 4 - Holy digits Batman! The Riddler is planning his...Ch. 4 - Your country is at war and your enemies are using...Ch. 4 - Prob. 12PPCh. 4 - Prob. 13PPCh. 4 - Prob. 14PPCh. 4 - (Challenge) Repeat the previous project, but...Ch. 4 - Write a JavaFx application that displays a series...
Knowledge Booster
Similar questions
- In Java only--Java Applets Create an applet that will draw a set of ovals and the user should be able to specify the number of ovals. Thank youarrow_forwardThe Yukon Widget Company manufactures widgets that weigh 9.2 pounds each. Write a program that calculates how many widgets are stacked on a pallet, based on the total weight of the pallet. The program should ask the user how much the pallet weighs by itself and with the widgets stacked on it. It should then calculate and display the number of widgets stacked on the pallet.arrow_forwardPart 1: 1. Write a JavaFX program that create a simple calculator for performing addition, subtraction, multiplication, and division, as shown below. E Simple Calculator First Number: Second Number: Result: Add Subtract Multiply Dividearrow_forward
- using paintComponent(Graphics g) Write a program in java that, for four points A, B, C and P, • draws a triangle formed by ABC and a small cross showing the position of P; • displays a line of text indicating which of the following three cases applies: P lies (a) inside ABC, (b) outside ABC, or (c) on an edge of ABC. The user will specify the four points by clicking. please don't copy from chegg, correct answer gets up voted thanks.arrow_forwardPart 1::-arrow_forwardImplement the using Windows form App(.NET Framework) c# : 1- creat a Form titled “ Students ” 2- Add text box with max 100 letter, where student can enter his name 3- Add Grade combobox where student can select his grade (A-B-C-D-E-F) 4- Add button “Add”, when clicked the name and grade are added to the data view5- Add button “Stat” when clicked another form appears6- A data grid appears with grade vs count statistic (ex : A ,3 ) (please respond with screenshots )arrow_forward
- Write a program that draws a Black filled rectangle. Visual Basic language Blue Prk There are two buttons to change the color of the rectangle. Use invalidate () to refresh the form after clicking each button. Bue Prk Bue Prkarrow_forwardUsing java or c++ complete the task below: You are to create a 2D Bow and Arrow and shoot the arrow to hit the center of a 2D targetarrow_forwardYou have a 2D board and a person which starts travelling along the edges of that board & going towards to the centre but not going to box which he is going once through it. Your task is to print the path that he is followed and take that board also from the user. Preferred Programming language: JAVA.arrow_forward
- assembly language please Write a program that displays a single character in all possible combinations of foreground and background colors (combinations: 16×16 = 256). The colors are numbered from 0 to 15, so you can use a nested loop to generate all possible combinations. Sample Output:arrow_forwardUsing Microsoft Visual Studio and glut/freeglut in C++, Read a geometric model represented as triangle meshes and display it centered in the display window. v -1.0 -1.0 -2.0 v 1.0 -1.0 -2.0 v 1.0 1.0 -2.0 v -1.0 1.0 -2.0 v -1.0 -1.0 -4.0 v 1.0 -1.0 -4.0 v 1.0 1.0 -4.0 v -1.0 1.0 -4.0 f 1 2 3 f 3 4 1 f 6 5 7 f 5 8 7 f 2 6 3 f 7 3 6 f 1 4 5 f 4 8 5 f 4 7 8 f 4 3 7 f 5 6 1 f 6 2 1 Define a virtual camera in a 3D virtual scene, specifying its position, orientation and field of view. Render an object using points, wireframe and surface representations. Using your user interface (Preferably GUI), together with the mouse and keyboard, interactively perform the following tasks: 1. Translate the model / camera in X, Y and Z directions. 2. Rotate the model / camera around X, Y, and Z axes. 3. Rotate the model /camera according to the moving direction and distance of the mouse. 4. Zoom in and zoom out view of…arrow_forwardImage binarization converts a greyscale or a coloured image to a black and white image. Assume that you are given a greyscale image with text as shown in Figure 2 below. Write the Java program to convert the greyscale image to a black and white image. You may set your own estimated threshold value. A VILLAGE OF MORMONS-Over seven hun- dred Mormons reached this city from New York May 15th, and tarried with us till the early train westward set off this morning. There were enough of them to constitute a good sized village. Figure 2: Greyscale Text Imagearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage