Absolute Java (6th Edition)
Absolute Java (6th Edition)
6th Edition
ISBN: 9780134041674
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 4, Problem 8PP

Redefine the class Date in Display 4.13 so that the instance variable for the month is of type int instead of type String. None of the method headings should change in any way. In particular, no String type parameters should change to int type parameters. You must redefine the methods to make things work out. Any program that uses the Date class from Display 4.13 should be able to use your Date class without any changes in the program. In particular, the program in Display 4.14 should work the same whether the Date class is defined as in Display 4.13 or is defined as you do it for this project. Write a test program (or programs) that tests each method in your class definition.

Blurred answer
Students have asked these similar questions
I need to override the toString() method with my own, however I am not sure how to reference back to the parameters for the constructor of the class. I've included my code below. I even tried giving the class instance variables of the same name, however the error said the code was "unreachable." What am I doing wrong? /** * Superclass for the different types of appointments. * TODO: Appointments have a description & date MM/DD/YYYY * TODO: method: occursOn(int year, int month, int day); * 4 method constructor: year, month, day, description */ public class Appointment { /** * the constructor method for an Appointment. * * @param year - the year of the appointment. * @param month - the month of the appointment. * @param date - the day of the appointment. * @param description - a short description of the appointment. */ publicAppointment(intyear, intmonth, intdate, Stringdescription){ } /** * Method to return a string representation of the appointment. * Will be inherited by the…
Redefine the equals method of the class Date (Display 4.13) so that it hasa parameter of type Object and follows the other guidelines we gave for anequals method. (Remember, you should use getClass(), not instanceof.)
I am trying to add int instance variables for the current hour and minutes of a clock, and I am trying to make them private. I am also trying to write getHour and getMinutes getter methods for these instance variables. I would like to know if I did this correctly and if not, I would like assistance as to what I could change. public class DigitalClock {     private int currentHour;    private int currentMinutes;     public int getHour() {        return currentHour;    }     public void setHour(int currentHour) {        this.currentHour = currentHour;    }     public int getMinutes() {        return currentMinutes;    }     public void setMinutes(int currentMinutes) {        this.currentMinutes = currentMinutes;}}

Chapter 4 Solutions

Absolute Java (6th Edition)

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java Math Library; Author: Alex Lee;https://www.youtube.com/watch?v=ufegX5o8uc4;License: Standard YouTube License, CC-BY