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
Textbook Question
Chapter 5, Problem 11PP
Repeat
Graphics
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that draws a square fractal. Fractals are images that keep repeating their own image in ever-smaller versions. There exists numerous fractals and some fractals rely on computation of advanced mathematics. All fractals have a recursive quality and provide an ideal platform for practicing recursive concepts. You will note that from the four corners of the center rectangle, smaller rectangles are drawn and each rectangle in turn continues to draw three smaller rectangles until the rectangle is the size of one pixel.
A CODE TEMPLATE & PICTURE OF OUTPUT IS ALREADY PROVIDED IN THE ATTACHED PICTURES
Method drawSquare1 gets the ball rolling and draws a solid rectangle in the center of the screen. The initial rectangle needs to be 1/4 the size of the monitor. This explains why it is important to know the screen resolution and why this information is passed by parameter. Method drawSquare1 needs to make four method calls to draw each one of the four rectangles attached to…
Write a Java program that would resemble a payroll system. An input window which will accept the employee number and the number of days of rendered work. A 2d-arraylist that contains the employee number and the rate per day is to be searched and used to compute for the gross salary. Gross salary is computed by multiplying the number of days of rendered work by rate per day of the particular employee. If the gross salary computed is greater than 100,000 the tax is 20% of the gross salary, otherwise, the tax is 10%. Deduct the tax from the gross salary to get the net pay. Display the employee number, gross salary, tax deduction, and the net pay in an output window. Design your own input/output windows. ( USE OOP CONCEPT AND JOPTION)
Implement one of the sorts described in Chapters 15 and 16. Input is an array with at least 10 items. The items in the
array can be of several types (Suggested types are integers-denoting how many customers visited the store in the last
three weeks or strings-denoting the names of featured items). The items should be connected to a store in some way.
Use some of the given data fields
Print a title indicating what the data represents. Print the original data, AND the sorted data.
Chapter 5 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Ch. 5.1 - Consider the program in Listing 5.4 . Suppose you...Ch. 5.1 - Prob. 2STQCh. 5.1 - Prob. 3STQCh. 5.1 - Suppose every species in the world has a peculiar...Ch. 5.1 - Revise the definition of the method writeOutput in...Ch. 5.1 - Revise the definition of the method readInput in...Ch. 5.1 - Revise the definition of the method...Ch. 5.1 - What is the meaning of (int) that appears in the...Ch. 5.1 - Prob. 9STQCh. 5.1 - Define a method called getDensity that could be...
Ch. 5.1 - Define a method called changePopulation that could...Ch. 5.1 - Define a method called changePopulation that could...Ch. 5.2 - In Listing 5.12, we set the data for the object...Ch. 5.2 - Give preconditions and postconditions for the...Ch. 5.2 - What is an accessor method? What is a mutator...Ch. 5.2 - Give the complete definition of a class called...Ch. 5.2 - Prob. 17STQCh. 5.2 - In the definition of the method in Listing 5.15,...Ch. 5.2 - What is a well-encapsulated class definition?Ch. 5.2 - When should an instance variable in a class...Ch. 5.2 - Prob. 21STQCh. 5.2 - In a class definition, is anything private ever...Ch. 5.2 - In a class definition, is the body of any method...Ch. 5.3 - What is a reference type? Are class types...Ch. 5.3 - When comparing two quantities of a class type to...Ch. 5.3 - Prob. 26STQCh. 5.3 - Write a method definition for a method called...Ch. 5.3 - Given the class Species as defined in Listing...Ch. 5.3 - After correcting the program in the previous...Ch. 5.3 - What is the biggest difference between a parameter...Ch. 5.3 - Prob. 31STQCh. 5.3 - Write an equals method for the class Person...Ch. 5.4 - Rewrite the method drawFaceSansMouth in Listing...Ch. 5 - Design a class to represent a credit card. Think...Ch. 5 - Repeat Exercise 1 for a credit card account...Ch. 5 - Repeat Exercise 1 for a coin instead of a credit...Ch. 5 - Repeat Exercise 1 for a collection of coins...Ch. 5 - Consider a Java class that you could use to get an...Ch. 5 - Consider a class that keeps track of the sales of...Ch. 5 - Consider a class MotorBoat that represents...Ch. 5 - Prob. 8ECh. 5 - Prob. 9ECh. 5 - Prob. 10ECh. 5 - Write a program to answer questions like the...Ch. 5 - Define a class called Counter. An object of this...Ch. 5 - Prob. 3PCh. 5 - Define a Trivia class that contains information...Ch. 5 - Define a Beer class that contains the following...Ch. 5 - Write a grading program for an instructor whose...Ch. 5 - Add methods to the Person class from Self-Test...Ch. 5 - Create a class that represents a grade...Ch. 5 - Write a program that uses the Purchase class in...Ch. 5 - Write a program to answer questions like the...Ch. 5 - Consider a class that could be used to play a game...Ch. 5 - Consider a class BasketballGame that represents...Ch. 5 - Consider a class ConcertPromoter that records the...Ch. 5 - Prob. 9PPCh. 5 - Consider a class Movie that contains information...Ch. 5 - Repeat Programming Project 18 from Chapter 4, but...Ch. 5 - Prob. 12PP
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
_____ is data the computer collects from the world outside of the computer.
Starting Out With Visual Basic (7th Edition)
Convert the following for loop to a while loop: for (int x = 50; x 0; x--) { System.out.println(x + seconds t...
Starting Out with Java: Early Objects (6th Edition)
The ________ object is assumed to exist and it is not necessary to include it as an object when referring to it...
Web Development and Design Foundations with HTML5 (8th Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th Edition)
____ variables are defined outside all functions and are accessible to any function within their scope.
Starting Out with C++: Early Objects (9th Edition)
Explain what will happen if you leave the WHERE clause off your answer to question 3.44.
Database Concepts (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- FOR JAVA Write a method that takes a String array and an integer as parameters and prints the Strings in the array whose length is greater than the second parameter.arrow_forwardAttached. In Java, please. Short and executable.arrow_forwardRewrite Exercise 3.4 using the following func tion to return the area of a pentagon: def area(s):arrow_forward
- Make the photo below into a grayscale using python. Let us assume that the photo below is located in a folder name 'pic' and the name of the photo is Bird.jpgCode for gray: def grayscale(image): for y in range(image.getHeight()): for x in range(image.getWidth()): (r, g, b) = image.getPixel(x, y) r = int(r * 0.299) g= int(g * 0.587) b = int(b * 0.114) lum = r + g + b image.setPixels(x, y, (lum, lum, lum))arrow_forwardImplement a “To Do” list. Tasks have a priority between 1 and 9, and a description (which you can come up with on your own, say, “wash dishes”). The program is going to prompt the user to enter the tasks by running the method add_priority_description, the program adds a new task and prints the current list with priority 1 tasks on the top, and priority 9 tasks at the bottom. The program will continue to ask the user if they want to add another tasks, and repeat the add_priority_description method, or enters Q to run the quit method to quit the program. Sample output (not limited to) 1. Study for the final 1. Take the final 2. Watch Justice League with friends 3. Play ball 9. Wash Dishes 9. Clean room. There is a possibility of two tasks having the same priority. If so, the last task that was entered gets to be printed first. Use HEAP in your solution.arrow_forwardCreate, compile, and run a recursive program. Choose one of the labs listed below and program it. More details for the lab can be found in the first PowerPoint for Chapter 9. Make sure your code is recursive. You can think of recursive code this way: If you cut and paste a recursive method into another class, it should still run without problems. In other words, you cannot have any instance variables (class-level variables) that the method depends on. Choice 1 - boolean isPalindrome (String str) that returns true if the input string is a palindrome. Choice 2 - boolean find (string fullStr, string subStr) that tests whether the string subStr is a substring of fullStr Choice 3- int numDigits (int num) to determine the number of digits in the number num Choice 4 - double intPower (double x, int n) to compute x^n, where n is a positive integer and x is a double precision variable Choice 5-void printSubstr (String str) that prints all substrings of the input string.arrow_forward
- Write this program in Java using a custom method. Implementation details You will implement this program in a specific way in order to gain some experience with loops, arrays and array lists. Use an array of strings to store the 4 strings listed in the description. Use a do-while loop for your 'game engine'. This means the game starts once the user enters money. The decision to stop occurs at the bottom of the loop. The do-while loop keeps going until the user quits, or there is no money left. The pseudocode for this 'game engine' is shown below: determine the fruits to display (step 3 below) and print them determine if there are 3 or 4 of the same image display the results update the customer balance as necessary prompt to play or quit continue loop if customer wants to play and there's money for another game. Use the Random class to generate a random number between 0 and 3. This random number will be an index into the array of strings. Add the string at that index to an…arrow_forwardusing web vPython 3.1arrow_forwardPlease solve this problem in javaarrow_forward
- Write a Java program that asks the user to enter a string and counts how many times the letter "s" or "S" appears in the string. Display that number and then display the string that many times. Requirements: Call a method that gets the string from the user. Use recursion to ensure the string has at least 5 characters. Call a method that returns the number of times the letter "s" or "S" appears in the string. This method should use recursion. Call a method that takes the number of times the letter"s" or "S" appeared in the string and display the original string that was obtained from the user that many times using recursion. Call a method that sorts the letters in the string and searches for the letter "m". Display Found or Not Found.arrow_forwardImplement a class Quiz that implements the Measurable interface. A quiz has a score and a letter grade (such as B+). Use the Data class to process an array of quizzes. Display the average score and the quiz with the highest score (both letter grade and score). In javaarrow_forward2. Write a Java program that would resemble a payroll system. An input window which will accept the employee number and the number of days of rendered work. A 2d-arraylist that contains the employee number and the rate per day is to be searched and used to compute for the gross salary. Gross salary is computed by multiplying the number of days of rendered work by rate per day of the particular employee. If the gross salary computed is greater than 100,000 the tax is 20% of the gross salary, otherwise, the tax is 10%. Deduct the tax from the gross salary to get the net pay. Display the employee number, gross salary, tax deduction, and the net pay in an output window. Design your own input/output windows.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License