Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
6th Edition
ISBN: 9780134477367
Author: David J. Barnes, Michael Kolling
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 3, Problem 33E
Given a variable
Printer p1;
which currently holds a reference to a printer object, and two methods inside the Printer class with the headers
public void print (String filename, boolean doubleSided) public int getStatus (int delay)
write two possible calls to each of these methods.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
There are 12 inches in a foot and 3 feet in a yard.
Create a class named InchConversion. Its main() method accepts a value in inches from a user at the keyboard, and in turn passes the entered value to two methods. One converts the value from inches to feet, and the other converts the same value from inches to yards.
Each method displays the results with appropriate explanation.
import java.util.Scanner;
public class InchConversion {
public static void main (String args[]) {
// Write your code here
}
public static void convertToFeet(int inches) {
// Write your code here
}
public static void convertToYards(int inches) {
// Write your code here
}
}
Reposting as I was getting the wrong answers!!! Java only and please read the description
I have an unfinished java class, I need to write 4 methods there
1st step : create a file reader that reads the shape files supplied to you. Eachline of the shape file specifies a shape. The format of this line differs depending on the shape ( files supplied to me : ExampleShapes.txt, TwoRedCircles.txt, and ExampleShapesStill.txt)
step 2 : I would start by trying to read a single line of the filefollowed by multiple lines, printing them to the screento ensure you are reading the data correctly. Then, cre-ate instances of the shape objects and print them out.You can do this by calling the toString() methodthat has already been given to you.
step 3: If the file does not exist, quit the program grace-fully and output Could not find <filename>to the screen (standard out) with <filename> re-placed by the file that will not open. However, youcan assume that each line of the file has the…
Create a class named Movie that holds a movie name and rating;
Provide methods to get and set both the movie name and rating;
import.java.util.scanner class
Chapter 3 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Ch. 3 - Prob. 1ECh. 3 - At what time (s) can a class diagram change? How...Ch. 3 - At what time(s) can an object diagram change? How...Ch. 3 - Write a definition of a field named tutor that can...Ch. 3 - Prob. 5ECh. 3 - Create a second NumberDisplay object with a limit...Ch. 3 - Select Show Code Pad from the View menu. Create a...Ch. 3 - What error message do you see in the Code Pad if...Ch. 3 - What error message do you see in the Code Pad if...Ch. 3 - What happens when the setValue method is called...
Ch. 3 - Prob. 11ECh. 3 - Prob. 12ECh. 3 - Which of the following expressions return...Ch. 3 - Write an expression using boolean variables a and...Ch. 3 - Write an expression using boolean variables a and...Ch. 3 - Consider the expression (a && b). Write an...Ch. 3 - Does the getDisplayValue method work correctly in...Ch. 3 - Prob. 18ECh. 3 - In Exercise 2.79 you were asked to investigate...Ch. 3 - Explain the modulo operator. You may need to...Ch. 3 - What is the result of the expression 83?Ch. 3 - Try out the expression in the Code Pad. Try other...Ch. 3 - Prob. 23ECh. 3 - Prob. 24ECh. 3 - Explain in detail how the increment method works.
Ch. 3 - Rewrite the increment method without the modulo...Ch. 3 - Open the clock-display project and create a...Ch. 3 - Prob. 28ECh. 3 - Prob. 29ECh. 3 - Prob. 30ECh. 3 - Look at the second constructor in C1ockDisplay's...Ch. 3 - Prob. 32ECh. 3 - Given a variable Printer p1; which currently holds...Ch. 3 - Open the house project from Chapter 1 and review...Ch. 3 - Prob. 35ECh. 3 - Does the Picture class contain any internal method...Ch. 3 - Remove the following two statements from the draw...Ch. 3 - Prob. 38ECh. 3 - Prob. 39ECh. 3 - Assume a class Tree has a field of type Triangle...Ch. 3 - Prob. 41ECh. 3 - Open the mail-system project, which you can find...Ch. 3 - Prob. 43ECh. 3 - Prob. 44ECh. 3 - Open the editor for the MailClient class and set a...Ch. 3 - Step one line forward in the execution of the...Ch. 3 - Prob. 47ECh. 3 - Prob. 48ECh. 3 - Prob. 49ECh. 3 - Set a breakpoint in the first line of the sendMai1...Ch. 3 - Use a combination of code reading, execution of...Ch. 3 - Use the debugger to investigate the clock-display...Ch. 3 - Prob. 53ECh. 3 - Prob. 54ECh. 3 - Prob. 55ECh. 3 - Describe the changes that would be required to the...Ch. 3 - Write the code for the timeTick method in...Ch. 3 - Discuss whether the current design of the...Ch. 3 - Challenge exercise In the current design of...
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
- Step 1: Code in Java and name the java class file Artwork.javaStep 2: Have your JavaFx program set the Stage title to be your first and last name in the start method.Step 3: For this assignment, you are to create some simple JavaFx “generative art” Step 4: Your program must use one or more of the shape classes like Rectangle, Text, Circle, Arc, etc. (Refer to Javadoc page for ideas)Step 5: Your program must use one or more colors. (Refer to Javadoc page for ideas)Step 6: Your program must use java.util.Random to make the output change each time your program is run (for example, the colors, locations, and size of the shapes).Step 7: Describe the program and its behavior in a couple sentences. Note: Make sure to include the used javafx import statements in the solution box.arrow_forwardDefine a class named TimeSpan. A TimeSpan object stores a span of time in hours and minutes (for example, the time span between Monday 8AM and Wednesday 10:30AM is 50 hours, 30 minutes). Each TimeSpan object should have the following public methods: 00000 TimeSpan (hours, minutes) Constructs a Timespan object storing the given time span of minutes and seconds. add (hours, minutes) Adds the given amount of time to the current time span (e.g. 2 hours, 15 min + 1 hour, 45 min = 4 hours). Assume that the arguments are valid: the hours are non-negative, and the minutes are between 0 and 59. add (timespan) Adds the given amount of time (stored as a time span) to the current time span. getTotalHours () Returns the total time in this time span as the real number of hours (such as 9.75 for 9 hours, 45 min). tostring () Returns a string representation of the time span of hours and minutes, such as "28h4 6m". The minutes should always be reported as being in the range of 0 to 59. That means that…arrow_forwardCan anyone solve this Task in python language?arrow_forward
- Image1 is my program, can you separate it to three methods base on the requirements(see image 2)arrow_forwardCode to 1. inherit Application class to HelloFX class. 2. Code for Overriding the start method from Application class. 3. Import codes for Button, Labels, and TextField 4. Create an Instance of class Button, Labels, and TextField and assign them on their respective objects. 5. Call the method setOnAction() using the button object.arrow_forwardAssume the following Window class has been defined: public class Window { private int width; private int height; private int xPos; private int yPos; // The rest of the class is not shown… } Define an equals method for the Window class. Two Window objects will be considered equal if their width fields are equal, their height fields are equal, their xPos fields are equal, and their yPos fields are equal.arrow_forward
- Java homework questions: Answer all exercises Not copied answer plzz Exercise 1 • Import and edit the Input04 project. • Run the code and examine the output. • Read through each next line until you find "BlueBumper". • The two numbers following "BlueBumper" are the object’s xPositon and yPosition. Store these coordinates as integers and print them. • Examine input04text.txt, if necessary. Input04.java package input04; import java.util.Scanner; public class Input04 { public static void main(String[] args){ Scanner sc = new Scanner(Input04.class.getResourceAsStream("input04text.txt")); //Edit these lines to advance the scanner sc.nextLine(); System.out.println(sc.nextLine()); //Does this line contain "BlueBumper"? System.out.println(sc.findInLine("BlueBumper")); //Store the next two numbers as xPosition and yPosition //Print these positions System.out.println("X: "…arrow_forward#this is a python programtopic: operation overloading, Encapsulation please find the attached imagearrow_forwardPythonarrow_forward
- Create a class called SquareTester that will create a Square object. Print out the toString method with the object as your receiver. Print out the perimeter using the getArea method and the object as your receiver. public class SquareTester { public static void main(String{}args) { //create your Square object with any value as your argument //print the toString method //print the area of the square on a new line -ex: “The area is: 64” } }arrow_forwardObjective: Write a class that will test dates and times inputted by the user and determine whether or not it is valid. This will focus on the usages of methods to organize code. First download the driver and put it in your project DO NOT ALTER THE DRIVER! Use this to run your project The driver : public class DateAndTimeDriver { public static void main(String[] args) { // TODO Auto-generated method stub DateAndTimeTester dtTester = new DateAndTimeTester(); dtTester.run(); } } Write a class file called DateAndTimeTester This DOES NOT have a main method Create the following methods run: This method returns nothing and takes no parameters. This is called by the driver and should handle all of the input from the Scanner and dialog for the user. isValid: returns true or false if a given String has the correct date and time. The String parameter should be formatted “MM/DD hh:mm” This method should call the methods isValidDate and isValidTime to determine this. isValidDate: returns…arrow_forwardWrite code to declare and create a Random class object (use the rand object reference variable). Then, using the nextInt method, create a list of expressions that produce random numbers in the following ranges, including the end points. Use the nextInt method's iteration that only takes an integer input.a. 0 to 10 b. 0 to 500c. 1 to 10d. 1 to 500e. 25 to 50f. -10 to 15 Write code to declare and create a Random class object (use the rand object reference variable). Then, using the nextInt method, create a list of expressions that produce random numbers in the following ranges, including the end points. Use the nextInt method's iteration that only takes an integer input.a. 0 to 10 b. 0 to 500c. 1 to 10d. 1 to 500e. 25 to 50f. -10 to 15arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Time Complexity Analysis - How To Calculate Running Time | InterviewBit; Author: InterviewBit;https://www.youtube.com/watch?v=--oxG4Q1PA0;License: Standard YouTube License, CC-BY