Introduction to Java Programming and Data Structures, Comprehensive Version, Student Value Edition (11th Edition)
11th Edition
ISBN: 9780134671604
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 13.7, Problem 13.7.3CP
Show the output of the following code:
java.util.Date date = new java.util.Date();
java.util.Date date1 = date;
java.util.Date date2 = (java.util.Date) (date.clone());
System.out.println(date == date1);
System.out.println(date == date2);
System.out.println(date.equals(date2));
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
please code in java and dont use advanced coding.. keep it basic
PROBLEM STATEMENT:
Return the factorial of the provided integer parameter.
public class FactorialComputation{public static int solution(int n){// ↓↓↓↓ your code goes here ↓↓↓↓return 0;}
Can you please help me with the question above
the Language is Java and can yiu use the java code that i gave above to answer the question
Write the rest of the Java code bellow:
Code:
class Main
{
publicstaticvoid main(String args[])
{
Schedule MondaySchedule = new Schedule();
// above constructor asks user to enter meeting times
MondaySchedule.sort();
System.out.println("Here is your schedule, sorted in order:");
System.out.print(MondaySchedule);
}
}
/* Sample Output:
Please enter the time for each meeting in hh:mm format, on a
separate line, and type 'end' on the final line to finish.
16:00
16:50
9:00
10:00
15:00
end
Here is your schedule, sorted in order:
09:00
10:00
15:00
16:00
16:50
-----------------------------------------
Please enter the time for each meeting in hh:mm format, on a
separate line, and type 'end' on the final line to finish.
17:00
15:00
13:00
11:00
end
Here is your schedule, sorted in order:
11:00
13:00
15:00
17:00
*/
Chapter 13 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version, Student Value Edition (11th Edition)
Ch. 13.2 - Prob. 13.2.1CPCh. 13.2 - The getArea() and getPerimeter() methods may be...Ch. 13.2 - True or false? a.An abstract class can be used...Ch. 13.3 - Prob. 13.3.1CPCh. 13.3 - Prob. 13.3.2CPCh. 13.3 - Prob. 13.3.3CPCh. 13.3 - What is wrong in the following code? (Note the...Ch. 13.3 - What is wrong in the following code? public class...Ch. 13.4 - Can you create a Calendar object using the...Ch. 13.4 - Prob. 13.4.2CP
Ch. 13.4 - How do you create a Calendar object for the...Ch. 13.4 - For a Calendar object c, how do you get its year,...Ch. 13.5 - Prob. 13.5.1CPCh. 13.5 - Prob. 13.5.2CPCh. 13.5 - Prob. 13.5.3CPCh. 13.5 - Prob. 13.5.4CPCh. 13.6 - Prob. 13.6.1CPCh. 13.6 - Prob. 13.6.2CPCh. 13.6 - Can the following code be compiled? Why? Integer...Ch. 13.6 - Prob. 13.6.4CPCh. 13.6 - What is wrong in the following code? public class...Ch. 13.6 - Prob. 13.6.6CPCh. 13.6 - Listing 13.5 has an error. If you add list.add...Ch. 13.7 - Can a class invoke the super.clone() when...Ch. 13.7 - Prob. 13.7.2CPCh. 13.7 - Show the output of the following code:...Ch. 13.7 - Prob. 13.7.4CPCh. 13.7 - What is wrong in the following code? public class...Ch. 13.7 - Show the output of the following code: public...Ch. 13.8 - Prob. 13.8.1CPCh. 13.8 - Prob. 13.8.2CPCh. 13.8 - Prob. 13.8.3CPCh. 13.9 - Show the output of the following code: Rational r1...Ch. 13.9 - Prob. 13.9.2CPCh. 13.9 - Prob. 13.9.3CPCh. 13.9 - Simplify the code in lines 8285 in Listing 13.13...Ch. 13.9 - Prob. 13.9.5CPCh. 13.9 - The preceding question shows a bug in the toString...Ch. 13.10 - Describe class-design guidelines.Ch. 13 - (Triangle class) Design a new Triangle class that...Ch. 13 - (Shuffle ArrayList) Write the following method...Ch. 13 - (Sort ArrayList) Write the following method that...Ch. 13 - (Display calendars) Rewrite the PrintCalendar...Ch. 13 - (Enable GeometricObject comparable) Modify the...Ch. 13 - Prob. 13.6PECh. 13 - (The Colorable interface) Design an interface...Ch. 13 - (Revise the MyStack class) Rewrite the MyStack...Ch. 13 - Prob. 13.9PECh. 13 - Prob. 13.10PECh. 13 - (The Octagon class) Write a class named Octagon...Ch. 13 - Prob. 13.12PECh. 13 - Prob. 13.13PECh. 13 - (Demonstrate the benefits of encapsulation)...Ch. 13 - Prob. 13.15PECh. 13 - (Math: The Complex class) A complex number is a...Ch. 13 - (Use the Rational class) Write a program that...Ch. 13 - (Convert decimals to fractious) Write a program...Ch. 13 - (Algebra: solve quadratic equations) Rewrite...Ch. 13 - (Algebra: vertex form equations) The equation of a...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Car Class Write a class named Car that has the following fields: yearModel. The yearModel field is an int that ...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Write a loop equivalent to the for loop above without using .
C Programming Language
What does a bounding box indicate about an object in the Designer?
Starting Out With Visual Basic (8th Edition)
A byte is made up of eight a. CPUs b. addresses c. variables d. bits
Starting Out with Java: From Control Structures through Objects (6th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
What is a named argument?
Starting out with Visual C# (4th 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
- import java.util.Scanner; public class TriangleArea { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Triangle triangle1 = new Triangle(); Triangle triangle2 = new Triangle(); // TODO: Read and set base and height for triangle1 (use setBase() and setHeight()) // TODO: Read and set base and height for triangle2 (use setBase() and setHeight()) System.out.println("Triangle with smaller area:"); // TODO: Determine smaller triangle (use getArea()) // and output smaller triangle's info (use printInfo()) }} public class Triangle { private double base; private double height; public void setBase(double userBase){ base = userBase; } public void setHeight(double userHeight) { height = userHeight; } public double getArea() { double area = 0.5 * base * height; return area; } public void printInfo() { System.out.printf("Base:…arrow_forwardJava: ShowStudent.java: class ShowStudent { public static void main (String args[]) { Student pupil = new Student(); pupil.setIdNumber(234); pupil.setPoints(47); pupil.setHours(15); pupil.showIdNumber(); pupil.showPoints(); pupil.showHours(); System.out.println("The grade point average is " + pupil.getGradePoint()); } } ShowStudent2.java: class ShowStudent2 { public static void main (String args[]) { Student pupil = new Student(); pupil.showIdNumber(); pupil.showPoints(); pupil.showHours(); System.out.println("The grade point average is " + pupil.getGradePoint()); } } Student.java: class Student { // the private data members private int idNumber; private int hours; private int points; // Constructor added in part c Student() { } // end of constructor added in part c // the public get and set methods public void…arrow_forwardJAVA CODE: check outputarrow_forward
- The following code has numerous errors that need to be fixed. import java.util.Scanner;public class LabProgram {public static int calcNumCharacters(String userString, char userChar) {int i;int numChars;i = ;numChars = ;while (i < userString.length() {if (userString.charAt(i) == userChar) {++numchars;++i;}retrn numChars;}public static void main(String[] args) {Scanner scnr = new Scanner(System.in);inputChar;inputString;numChars;inputChar = scnr.next().charAt(0);inputString = scnr.nextLine();numChars = calcnumCharacters(inputString, inputChar);System.out.print(numChars);System.out.print(" " + inputChar);if (numChars != 1) {System.out.print("'s");}System.out.println(); }arrow_forwardimport java.util.Scanner; public class Application {public static void main(String[] args){ int Num;float Ave;Employee[] Emp = new Employee[100]; System.out.println("Enter the number of employees:");Num = Integer.parseInt(new Scanner(System.in).nextLine());for (int i = 0; i < Num; i++){ Emp[i] = new Employee();Emp[i].Input();} System.out.printf("The list of employees:");System.out.println();Display(Emp, Num);Ave= AverageSalary(Emp, Num);System.out.printf("\nAverage salary is:" + "%.2f", Ave); System.out.printf("\nThe employee with highest salary is:\n" + employeeHigh(Emp, Num));}private static float AverageSalary(Employee [] emps, int n){float sum=0; for (int i = 0; i < n; i++)sum = sum + emps[i].salary;return sum/n;}private static void Display(Employee[] arr, int n){ for (int i = 0; i < n; i++){System.out.printf("%s",arr[i]);}}private static Employee employeeHigh(Employee[] arr, int n){ float high= arr[0].salary ;int iHigh = 0;for (int i = 1; i < n; i++){if( arr[i].salary…arrow_forwardCmplt all the terminal in code. Output requirements.arrow_forward
- I have problem in java 2 code: lease.setApartmentNumber(sc.nextLine()); melt:String cannot be converted to int and lease.setMonthlyRent(sc.nextLine()); melt introduce variable and lease.setPeriod(sc.nextLine()); melt: introduce variable System.out.println("Tenant's Name"+lease.getTenantName()+"\nApartment Number:"+lease.getApartmentNumber()+"\nMonthly Rent:"+NumberFormat.getCurrencyInstance().format(lease.getMonthlyRent())+"\nTerm of lease in month;"+lease.getPeriod());} melt: create Object getMonthlyRent() Java 1: package lease; public class Lease { private String tenantName;private int apartmentNumber;private double monthlyRent;private int Period; public Lease() {apartmentNumber = 0;int monthlyRent = 10000;int Period = 12; } // Getter Methodpublic String getTenantName() {return tenantName;} public void setTenantName(String tenantName) { this.tenantName = tenantName;} public int getApartmentNumber() {return apartmentNumber;} public void setApartmentNumber(int…arrow_forwardSee ERROR in Java file 2: Java file 1: import java.util.Random;import java.util.Scanner; public class Account {// Declare the variablesprivate String customerName;private String accountNumber;private double balance;private int type;private static int numObjects;// constructorpublic Account(String customerName, double balance, int type) { this.customerName = customerName;this.balance = balance;this.type = type;setaccountNumber(); // set account number functionnumObjects += 1;}private void setaccountNumber() // definition of set account number{Random rand = new Random();accountNumber = customerName.substring(0, 3).toUpperCase();accountNumber += type;accountNumber += "#";accountNumber += (rand.nextInt(100) + 100);}// function to makedepositvoid makeDeposit(double amount){if (amount > 0){balance += amount;}}// function for withdrawboolean makeWithdrawal(double amount) {if (amount < balance)balance -= amount;elsereturn false;return true;}public String toString(){return accountNumber +…arrow_forwardimport java.util.Scanner;public class LabProgram { public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int credits; int seed; GVDie die1, die2; die1 = new GVDie(); die2 = new GVDie(); // Read random seed to support testing (do not alter) seed = scnr.nextInt(); die1.setSeed(seed); // Read starting credits credits = scnr.nextInt(); int rounds = 0; while (credits > 0) { // Step 1: Roll both dice die1.roll(); die2.roll(); int total = die1.getValue() + die2.getValue(); if (total == 7 || total == 11) { // Player wins one credit credits++; // UPDATE - print the dice total here System.out.println("Dice total: " + total); //UPDATE - break the loop and end the round break; } else if (total == 2 ||…arrow_forward
- import java.util.Scanner; public class LabProgram { public static void main(String args[]) { Scanner scnr = new Scanner(System.in); int credits; int seed; GVDie die1, die2; die1 = new GVDie(); die2 = new GVDie(); // Read random seed to support testing (do not alter) seed = scnr.nextInt(); die1.setSeed(seed); // Read starting credits credits = scnr.nextInt(); int rounds = 0; while (credits > 0) { // Step 1: Roll both dice die1.roll(); die2.roll(); int total = die1.getValue() + die2.getValue(); if (total == 7 || total == 11) { // Player wins one credit credits++; } else if (total == 2 || total == 3 || total == 12) { // Player loses one credit credits--; } else { // Set the goal for future rolls int goal = total;…arrow_forwardplease help me with this error problem in java: import java.util.Arrays; import java.util.Scanner; import Project1.Employee; public class Payroll { privateStringfirstName; privateStringlastName; privateintemployeeNumber; privateEmployee[]employees; privateintemployeeCount; // Constructors publicStringgetLastName(){ returnlastName; } publicPayroll(){ employees=newEmployee[100]; employeeCount=0; } publicstaticvoidmain(String[]args){ Payrollpayroll=newPayroll(); payroll.run(); } publicvoidrun(){ Scannerkeyboard=newScanner(System.in); while(true){ System.out.println("Welcome to the Payroll System." +"Choose one of the following opions from 1-5:\n"); System.out.print("1) Create an employee\n" +"2)Search for an employee by last name\n" +"3)Display an employee by employee number\n" +"4)Run payroll\n" +"5)Quit\n"); intChoice=keyboard.nextInt(); keyboard.nextLine(); if(Choice==1){ createEmployee(); }elseif(Choice==2){ searchEmployee(); }elseif(Choice==3){…arrow_forwardCreate a read function and a print function with this code while creating a new object (data structure in java)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