DayTester.java 1 public class DayTester 2 ( public static void main(String() args) 34 System.out.printin(exanTwo.toString()); // This is the date for our exan2 System.out.println("Expected: 2022-04-26"); 3 4. // Step 2: Declare three int variables catled // Step 8: Display the number of days between // int days = exanTwo.daysFrom(examOne); 6. // year, month, and day with initial values of 2022, 3, 15. the two exans as a positive integer 41 int year - 2022; int month - 3; int day - 15;: // This is the number of days between our examl // and our exam2 System.out.println("Expected: 42"); 43 44 // Step 3: Construct a Day object using the three int 45 variables and assign it to a variable called exanone 46 // Step 9: Update examOne to the day 69 days later examone.addDays(69); 47 Day exanone - new Day (2022, 03, 15): 48 // Step 4: Display exanone on a line System.out.println{examOne.toString()); 49 // Step 10: Display examone on a line System.out.println(exanOne. toString()); 50 51 I/ This is the date for our exanl Systen.out.println{*Expected: 2022-03-15"); 52 53 I/ Step 5: Reset month to 4 and day to 26 month- 4; day - 26; // This is the date for our final exan System.out.println("Expected: 2822-05-23*); // Step 11: Display the number of days between // Step 6: Construct a Day object using the sane three variables and assign it to a variable called exanTwo examone and examTwo as a positive integer // Note: examOne now holds the date for our final exam

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Fix the code Make it look like the expect
Day Tester.java
1 public class DayTester
2 (
34
System.out.println(examTwo.toString());
35
// This is the date for our exam2
System.out.println("Expected: 2022-04-26");
public static void main(String[l args)
36
4.
37
5
// Step 2: Declare three int variables called
38
6
year, month, and day with initial values
of 2022, 3, 15.
// Step 8: Display the number of days between
//
int days = examTwo.daysFrom(examOne);
39
//
40
the two exams as a positive integer
int year = 2022;
int month = 3:
int day = 15;
41
6.
10
42
%3!
// This is the number of days between our examl
// and our exam2
System.out.println("Expected: 42");
11
43
12
// Step 3: Construct a Day object using the three int
44
13
14
15
variables and assign it to a variable
called examone
45
46
Day examone = new Day(2022, 03, 15);
// Step 9: Update examone to the day 69 days later
examOne.addDays(69);
47
16
48
17
// Step 4: Display exanone on a line
System.out.println(examOne.tostring());
18
49
// Step 10: Display examone on a line
System.out.println(examOne. tostring());
58
19
20
// This is the date for our examl
System.out.println("Expected: 2022-03-15*);
51
21
22
23
24
25
26
27
52
53
// Step 5: Reset month to 4 and day to 26
month - 4;
day = 26;
// This is the date for our final exam
System.out.println("Expected: 2922-05-23");
54
55
%3D
56
// Step 6: Construct a Day object using the same
57
// Step 11: Display the number of days between
58
examone and examTwo as a positive integer
28
three variables and assign it to a
variable called exanTwo
Day exanTwo = new Day(2022, 04, 26);
29
// Note: examone now holds the date for our final exam
System.out.printin(examOne);
//
59
30
60
61
31
32
// This is the number of days between our exam2 and
// our final exam.
System.out.println("Expected: 27");
62
33
/1 Step 7: Display exanTwo on a line
System.out.println(exanTwo.toStringt)):
63
34
35
64
36
37
// This is the date for our exam2
System.out.println("Expected: 2022-04-26*) :
65
66
I.
38
39
67
// Step 8: Display the number of days between
the two exas as a positive integer
ys exanTwo.daysFron(exanone):
49
41
CodeCheck
Reset
Download
42
A StringMethods.si.zip
Testing DayTester.java
Actual
Expected
2022-03-15
2022-03-15
a StringMethods.si..zip
Transcribed Image Text:Day Tester.java 1 public class DayTester 2 ( 34 System.out.println(examTwo.toString()); 35 // This is the date for our exam2 System.out.println("Expected: 2022-04-26"); public static void main(String[l args) 36 4. 37 5 // Step 2: Declare three int variables called 38 6 year, month, and day with initial values of 2022, 3, 15. // Step 8: Display the number of days between // int days = examTwo.daysFrom(examOne); 39 // 40 the two exams as a positive integer int year = 2022; int month = 3: int day = 15; 41 6. 10 42 %3! // This is the number of days between our examl // and our exam2 System.out.println("Expected: 42"); 11 43 12 // Step 3: Construct a Day object using the three int 44 13 14 15 variables and assign it to a variable called examone 45 46 Day examone = new Day(2022, 03, 15); // Step 9: Update examone to the day 69 days later examOne.addDays(69); 47 16 48 17 // Step 4: Display exanone on a line System.out.println(examOne.tostring()); 18 49 // Step 10: Display examone on a line System.out.println(examOne. tostring()); 58 19 20 // This is the date for our examl System.out.println("Expected: 2022-03-15*); 51 21 22 23 24 25 26 27 52 53 // Step 5: Reset month to 4 and day to 26 month - 4; day = 26; // This is the date for our final exam System.out.println("Expected: 2922-05-23"); 54 55 %3D 56 // Step 6: Construct a Day object using the same 57 // Step 11: Display the number of days between 58 examone and examTwo as a positive integer 28 three variables and assign it to a variable called exanTwo Day exanTwo = new Day(2022, 04, 26); 29 // Note: examone now holds the date for our final exam System.out.printin(examOne); // 59 30 60 61 31 32 // This is the number of days between our exam2 and // our final exam. System.out.println("Expected: 27"); 62 33 /1 Step 7: Display exanTwo on a line System.out.println(exanTwo.toStringt)): 63 34 35 64 36 37 // This is the date for our exam2 System.out.println("Expected: 2022-04-26*) : 65 66 I. 38 39 67 // Step 8: Display the number of days between the two exas as a positive integer ys exanTwo.daysFron(exanone): 49 41 CodeCheck Reset Download 42 A StringMethods.si.zip Testing DayTester.java Actual Expected 2022-03-15 2022-03-15 a StringMethods.si..zip
59
// Note: examOné how HULUS
60
System.out.println(examOne);
61
// This is the number of days between our exam2 and
// our final exam.
System.out.println("Expected: 27");
}
62
63
64
65
66 }
67
CodeCheck
Reset
Download
Testing DayTester.java
Actual
Expected
2022-03-15
2022-03-15
Expected: 2022-03-15 Expected: 2022-03-15
2022-04-26
2022-04-26
Expected: 2022-04-26 Expected: 2022-04-26
Expected: 42
2022-05-23
42
Expected: 42
Expected: 2022-05-23 2022-05-23
2022-05-23
Expected: 2022-05-23
27
Expected: 27
Expected: 27
fail
Score
0/1
A StringMethods.si...zip
Transcribed Image Text:59 // Note: examOné how HULUS 60 System.out.println(examOne); 61 // This is the number of days between our exam2 and // our final exam. System.out.println("Expected: 27"); } 62 63 64 65 66 } 67 CodeCheck Reset Download Testing DayTester.java Actual Expected 2022-03-15 2022-03-15 Expected: 2022-03-15 Expected: 2022-03-15 2022-04-26 2022-04-26 Expected: 2022-04-26 Expected: 2022-04-26 Expected: 42 2022-05-23 42 Expected: 42 Expected: 2022-05-23 2022-05-23 2022-05-23 Expected: 2022-05-23 27 Expected: 27 Expected: 27 fail Score 0/1 A StringMethods.si...zip
Expert Solution
Step 1Java code

Updated Java code for given question

import java.util.*; 
public class DayTester{

public static void main(String[] args){

int year=2022;
int month=3;
int day=15;

Day examOne= new Day(2022, 03, 15);

System.out.println(examOne.toSring());

System.out.println("Expected: 2022-03-15");


month= 4;

day= 26;

Day examTwo= new Day(2022, 04, 26);

System.out.println(examTwo.toString());

System.out.println("Expected: 2022-04-26"); 

int days= examTwo.daysFrom(examOne);
System.out.println("42");
System.out.println("Expected: 42");
examOne.addDays(69);
System.out.println(examOne.toSring());

System.out.println("2022-05-23"); 
System.out.println("Expected: 2022-05-23"); 

System.out.println(examOne);

System.out.println("27"); 
System.out.println("Expected: 27");
}
}

 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Developing computer interface
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
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education