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
Make a text file with the matter of output image.
Write a ajax program to fetch the txt file and print the below output .
Write a program in Python that uses tkinter to display a window with 3 fields asking a user for their email, first name, and last name. Add 1 button named 'submit' that will open a file called 'subscription.txt' and append the three values to the end of the file.
Create a TestTriangle class in an individual .java file. In the main method,(1) Create a Triangle object with default base and height values.(2) Create a Triangle object with specified base = 3 and height =4.
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
- Write a program that lets the user click ona pane to dynamically create and remove points (see Figure ). When theuser left-clicks the mouse (primary button), a point is created and displayedat the mouse point. The user can remove a point by pointing to it and rightclickingthe mouse (secondary button).arrow_forwardpublic static void printer() { printer("Start:"); } public static void printer(String value) { System.out.print(value); printer(value + "v2", value + 3); } public static void printer(String v1, String v2) { System.out.print(v1 + "," + v2); printer(3); } public static void printer(double val) { System.out.print(val / 2); } Given the following code, what is printed if printer("Go", "G0") is invoked? public static void printer() { printer("Start:"); } public static void printer(String value) { System.out.print(value); printer(value + "v2", value + 3); } public static void printer(String v1, String v2) { System.out.print(v1 + "," + v2); printer(3); } public static void printer(double val) { System.out.print(val / 2); } Answer Choices: A. answer not listed B. Start:Go,G01.5 C. Go,G03 D. Go,G01.5 E. Nothing - the…arrow_forwardGiven the following class, instantiate three distinct objects and give them the data as indicated in the table below. (Image is attached) (Use Java) class Shipment { int id; double weight; double length, width, height; boolean sent; Shipment(int id, double weight, double length, double width, double height) { this.id = id; this.weight = weight; this.length = length; this.width = width; this.height = height; this.sent = false; } void send() { this.sent = true; } }arrow_forward
- The first one is answered as follows. Help with the second one. package test;import javax.swing.*;import java.awt.*;import java.awt.event.*; public class JavaApplication1 { public static void main(String[] arguments) { JFrame.setDefaultLookAndFeelDecorated(true);JFrame frame = new JFrame("print X and Y Coordinates");frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout());frame.setSize(500,400); final JTextField output = new JTextField();;frame.add(output,BorderLayout.SOUTH); frame.addMouseListener(new MouseListener() {public void mousePressed(MouseEvent me) { }public void mouseReleased(MouseEvent me) { }public void mouseEntered(MouseEvent me) { }public void mouseExited(MouseEvent me) { }public void mouseClicked(MouseEvent me) {int x = me.getX();int y = me.getY();output.setText("Coordinate X:" + x + "|| Coordinate Y:" + y);}}); frame.setVisible(true);}}arrow_forwardThis is a program that checks if a password meets certain requirements. I missed some of the instructions and even though it works, whenever an invalid password is entered it does not give the requested output. I am stuck on how to fix it because I get erros trying to change it. (expected output in pictured attached) public static void main(String[] args) { Scanner console= new Scanner(System.in); welcomeMenu(); boolean finished = false; while(!finished) { displayMenu(); String response= userInput(console); finished= getOption(console, response); } System.out.println("You are exiting this program. Thanks for usign it. See you later!"); } //method that takes the user-entered password public static void gettingPassword(Scanner console) { System.out.println("Please enter password: "); String password = console.next(); passwordLength(password); validatePassword(password); } //method that welcomes the user and explain the task achieved by the program public static void welcomeMenu() {…arrow_forwardI am trying to make a contact book using javafx. I am not sure how to search for the contact saved in txt file. please help me. public void search{ } please fill this using fileInputStreamarrow_forward
- Suppose you are working with a class for manipulating images. This class has a method called resize. The method takes as input a double that is greater than or equal to 0, and the value is the proportion of the current size. So an input of 0.5 will half the size, 1.0 will keep it the same, and 2.0 will double the size. The method throws an IllegalArgumentException. Which of the following are true? Group of answer choices Which one the answer: Assume you have an image called Image1.png in the correct location. You also have the code:MyImage im = new MyImage(“Image1.png”);resize(1000.0);This code will result in an IllegalArgumentExceptionbeing thrown. Assume you have an image called Image1.png in the correct location. You also have the code:MyImage im = new MyImage(“Image1.png”);resize(0);This code will result in an IllegalArgumentExceptionbeing thrown. All of the other options are true. Assume you have an image called Image1.png in the correct location. You also have…arrow_forwardI need help: Please help me correct it the mistake I keep receiving this error: TestFrame1.java:29: error: count has private access in FrameSystem.out.println("Total number of frames created: " + frame.count);1 error. Below is the code: import java.util.Scanner;public class TestFrame1 { // Scanner class instance private static Scanner scanner; // Main()public static void main(String[] args) {scanner = new Scanner(System.in);//make frameFrame frame = makeFrame();//calc costdouble cost = calcCost(frame);// Display frame attributes and costSystem.out.println(frame);System.out.println(String.format("Total cost of frame: $%.2f", cost));// Prompt user to buy another deskSystem.out.println("Do you want to buy another desk? (y/n)");String input = scanner.next();// If yes, then repeat above stepsif (input.toLowerCase().equals("y")) {frame = makeFrame();double cost2 = calcCost(frame);cost += cost2;System.out.println("Total number of frames created: " +…arrow_forwardAnalyze the following JavaFX program and complete the missing code based on the comments. The Program should show window like this. public class EmployeeInterface extends Application{ @Override public void start(Stage stage) throws Exception { 1- // Create a boreder Pane object 2- // create HBox object 3- // create the two command button objectsarrow_forward
- JAVA code can only be added to the MessageDetails.java file. Between lines of get code (ie libnes 12 and 14, as seen on image).arrow_forwardI need help with creating a Java program described in the image below: CourseInformation.java: import java.util.Scanner; public class CourseInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Course myCourse = new Course(); OfferedCourse myOfferedCourse = new OfferedCourse(); String courseNumber, courseTitle; String oCourseNumber, oCourseTitle, instructorName, location, classTime; courseNumber = scnr.nextLine(); courseTitle = scnr.nextLine(); oCourseNumber = scnr.nextLine(); oCourseTitle = scnr.nextLine(); instructorName = scnr.nextLine(); location = scnr.nextLine(); classTime = scnr.nextLine(); myCourse.setCourseNumber(courseNumber); myCourse.setCourseTitle(courseTitle); myCourse.printInfo(); myOfferedCourse.setCourseNumber(oCourseNumber); myOfferedCourse.setCourseTitle(oCourseTitle); myOfferedCourse.setInstructorName(instructorName);…arrow_forward2. Create a simple program that includes JFrame, JPanel, JLabel, JFields, JTextArea, and JButton. The program should ask the user for the following input:• First name• Last name• Middle name• Mobile number• E-mail address.3. Use the following methods and classes in creating the program: 4. Two (2) frames will be used in this program: OUTPUT and INPUT. The following conditions must be satisfied by the program.Input Frame: • Set the window name to INPUT.• The input frame should collect all the details listed on Step 2.• It should contain Submit and Clear All buttons.• When the Submit button is clicked, it should generate the output frame and disable the Submit button.• When the Clear All button is clicked, it should clear all the content that were entered by the user in the input frame, and close the output frame if it is open. Output Frame: • Set the window name to OUTPUT.• The output frame should display all the details that were entered by the user with the corresponding label.• The…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
Time Complexity Analysis - How To Calculate Running Time | InterviewBit; Author: InterviewBit;https://www.youtube.com/watch?v=--oxG4Q1PA0;License: Standard YouTube License, CC-BY