Placeholder

CSIS 312 Assignment 1 Time2 Class

$19.00

Description

Using the Time2.java and Time2Test.java files provided, it would be perfectly possible to represent the time internally as the total number of seconds since midnight rather than with the three integer values hour, minute, and second. Clients could use the same public methods and get the same results. Modify the Time2 class so that time is represented internally as seconds by replacing the instance variables hour, minute, and second with a single instance variable called totalSeconds, and then use Time2Test.java to test your modified Time2 class.  If your implementation is correct, the output of Time2Test should be the same as it was before you made any changes to Time2.
Note that the three argument constructor calls setTime() which then calls the setters and thereby demonstrates, whenever the three argument constructor is called, that the setters all work.  Your solution should focus on changing setters and getters and should continue using them to get full credit for your work.
Be sure you read the lab submittal instructions to submit your lab properly.  If you don’t submit your lab properly you won’t get any credit for your work and you will not be allowed to resubmit your assignment.
Submit this assignment by 11:59 p.m. (ET) on Monday of Module/Week 1.
SCREENSHOTS
SOLUTION
PAYMENT
CSIS 312 Assignment 1 Screenshot
CSIS 312 Assignment 1 Report
The solution consists of:
A report word document for this assignment
All Java programs and classes
A Netbeans project in case you want to run the project on your computer.
Screenshots showing program running
Attachments [Move over files to preview content of those files]
CSIS_312_Assignment_1.zip (188.62 KB)
classes
Time2.class
Time2Test.class
CSIS312-Assignment-1-Report.docx
Netbeans project
CSIS312Assignment1
pom.xml
src
main
java
Time2.java
Time2Test.java
target
classes
.netbeans_automatic_build
Time2.class
Time2Test.class
generated-sources
annotations
maven-status
maven-compiler-plugin
compile
default-compile
createdFiles.lst
inputFiles.lst
test-classes
.netbeans_automatic_build
screenshots
CSIS312-Assignment-1-Screenshot-1.png
CSIS312-Assignment-1-Screenshot.png
source code
Time2.java
Time2Test.java
Preview Time2.java
{
xxxx(0, 0, 0); // xxxxxx xxxxxxxxxxx xxxx xxxxx xxxxxxxxx
}
// xxxx2 xxxxxxxxxxx: xxxx xxxxxxxx, xxxxxx xxx xxxxxx xxxxxxxxx xx 0
public Time2(int hour) { this(hour, 0, 0); // invoke constructor with three arguments }
// Time2 constructor: hour and minute supplied, second defaulted to 0 public Time2(int hour, int minute) { this(hour, minute, 0); // invoke constructor with three arguments }
// Time2 constructor: hour, minute and second supplied
xxxxxx xxxx2(xxx xxxx, xxx xxxxxx, xxx xxxxxx)
{
xx (xxxx < 0 || xxxx >= 24)
xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx(“xxxx xxxx xx 0-23”);
xx (xxxxxx < 0 || xxxxxx >= 60)
Preview Time2Test.java
xxxx2 x4 = xxx xxxx2(12, 25, 42); // 12:25:42
xxxx2 x5 = xxx xxxx2(x4); // 12:25:42
xxxxxx.xxx.xxxxxxx(“xxxxxxxxxxx xxxx:”);
xxxxxxxxxxx(“x1: xxx xxxxxxx xxxxxxxxx”, x1);
displayTime(“t2: hour specified; default minute and second”, t2); displayTime(“t3: hour and minute specified; default second”, t3); displayTime(“t4: hour, minute and second specified”, t4); displayTime(“t5: Time2 object t4 specified”, t5);
// attempt to initialize t6 with invalid values try { Time2 t6 = new Time2(27, 74, 99); // invalid values } catch (IllegalArgumentException e) {
xxxxxx.xxx.xxxxxx(“%xxxxxxxxxx xxxxx xxxxxxxxxxxx x6: %x%x”,
x.xxxxxxxxxx());
}
}
// xxxxxxxx x xxxx2 xxxxxx xx 24-xxxx xxx 12-xxxx xxxxxxx
Preview Time2.java
{
xxxx(0, 0, 0); // xxxxxx xxxxxxxxxxx xxxx xxxxx xxxxxxxxx
}
// xxxx2 xxxxxxxxxxx: xxxx xxxxxxxx, xxxxxx xxx xxxxxx xxxxxxxxx xx 0
public Time2(int hour) { this(hour, 0, 0); // invoke constructor with three arguments }
// Time2 constructor: hour and minute supplied, second defaulted to 0 public Time2(int hour, int minute) { this(hour, minute, 0); // invoke constructor with three arguments }
// Time2 constructor: hour, minute and second supplied
xxxxxx xxxx2(xxx xxxx, xxx xxxxxx, xxx xxxxxx)
{
xx (xxxx < 0 || xxxx >= 24)
xxxxx xxx xxxxxxxxxxxxxxxxxxxxxxxx(“xxxx xxxx xx 0-23”);
xx (xxxxxx < 0 || xxxxxx >= 60)
Preview Time2Test.java
xxxx2 x4 = xxx xxxx2(12, 25, 42); // 12:25:42
xxxx2 x5 = xxx xxxx2(x4); // 12:25:42
xxxxxx.xxx.xxxxxxx(“xxxxxxxxxxx xxxx:”);
xxxxxxxxxxx(“x1: xxx xxxxxxx xxxxxxxxx”, x1);
displayTime(“t2: hour specified; default minute and second”, t2); displayTime(“t3: hour and minute specified; default second”, t3); displayTime(“t4: hour, minute and second specified”, t4); displayTime(“t5: Time2 object t4 specified”, t5);
// attempt to initialize t6 with invalid values try { Time2 t6 = new Time2(27, 74, 99); // invalid values } catch (IllegalArgumentException e) {
xxxxxx.xxx.xxxxxx(“%xxxxxxxxxx xxxxx xxxxxxxxxxxx x6: %x%x”,
x.xxxxxxxxxx());
}
}
// xxxxxxxx x xxxx2 xxxxxx xx 24-xxxx xxx 12-xxxx xxxxxxx
Price: $19
You May Also Like:
CSIS 312 Entire Course
CSIS 312 Assignment 2 Employee Class
CSIS 312 Assignment 3 Payroll System
CSIS 312 Assignment 4 Random Sentences
CSIS 312 Assignment 5 LinkedList Object
CSIS 312 Assignment 7 Pair Class
CSIS 312 Assignment 6 Print Array
CSIS 312 Assignment 8 SecureRandom

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.