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
![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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F170cb9b5-2292-4ecc-9f24-3c60291ff66d%2F691c57af-ef72-4e14-8947-66112e847d28%2Fnb755vo_processed.jpeg&w=3840&q=75)
![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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F170cb9b5-2292-4ecc-9f24-3c60291ff66d%2F691c57af-ef72-4e14-8947-66112e847d28%2Fsvlwua7_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
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
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)