Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CSIS 312 Modify a Class Implementation Assignment Instructions Using the Time2.java and Time2Test.java files provided, it would be perfectly possible to represent the time internally as the total...

1 answer below »

CSIS 312
Modify a Class Implementation Assignment Instructions
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 co
ect, 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.
Modify a Class Implementation Tips
· Accomplish your task incrementally.
· In Time2
· Create a new instance variable called totalSeconds to keep track of the total number of seconds from midnight.
· Now start converting the getters and setters starting with getHour() and setHour(). Since you need getHour() to complete setHour() start with getHour(). getHour() just returns totalSeconds / 60 / 60. setHour() subtracts out the cu
ent value for the hour and then adds the new value. setHour() looks like the following:
· You should now be able to delete the instance variable hour and when you run Time2Test.java the output should be exactly the same as it was before you made the changes to getHour() and setHour().
· Now do the same thing to getMinute() and setMinute() coming up with the co
ect formulas to work with minutes instead of hours. Then delete the instance variable minute.
· Finally, convert getSecond() and setSecond() and when you are done delete the instance variable second.
· In Time2Test.java the only change you are allowed to make is to add a statement at the beginning of main() to output your name and lab number.

CSIS 312
Assignment Submittal Instructions
Once you have your assignment running (your assignment must run to get any credit for it) use the following steps to submit your work:
At the head of any of the files that you have changed (adding an output statement for your name and lab number does not constitute a change in this context) or created that comprise your program (.java files) add the following:
File name> --
ief statement as to the file’s purpose
CSIS 312-
Citations if necessary> -- citations are required
for any references you used (outside of your book,
the website associated with your book, or references
provided in class).
At the beginning of main() insert the following line:
System.out.println(“Student Name – Assignment #\n”);
Substitute your name for student name and
the lab number for #
Make a screen shot of your assignment running.
Paste your screen shot into a Word document with the title of your lab and your name clearly labeled at the top (see example below). Additionally, below the screen shot you need to assert the following 4 integrity assertions:
a. I have not shared the source code in my program with anyone other than my instructor’s approved human sources.
. I have not used source code obtained from another student, or any other unauthorized source, either modified or unmodified.
c. If any source code or documentation used in my program was obtained from another source, such as a text book or course notes, that has been clearly noted with a proper citation in the comments of my program.
d. I have not knowingly designed this program in such a way as to defeat or interfere with the normal operation of any machine it is graded on or to produce apparently co
ect results when in fact it does not.
Save this file using the following format: firstname_lastname.doc or docx.
To get any credit for the assignment you must include all of the following in a single zip file (do not submit multiple zip files – put all of the following files in a single zip file):
e. The Word document you created above
f. All of your project .java files (not just the ones you changed, but all the .java files that constitute your project, even the ones provided for you).
g. All of the .class files (there should be one .class file for every .java file)
If your assignment consists of more than one sub-assignment then create a separate zip file for each sub-assignment, each with the contents listed in step 6 above.
Page 2 of 2

Ru
ic
    Modify a Class Implementation Assignment Grading Guide            80    <- Lab Value
    Well done :). You met the requirements of the assignment creatively, applying the lessons learned from this week's reading. Keep up the good work.
    Item    %Val    %Earned    Points    Comments
    Lab must compile and run, meet one or more of the assignment requirements, and be co
ectly submitted (zip file with all .java and .class files and a Word document with screen shot(s) and integrity statements) to get any credit for your work.        Yes
    Content
    Program satisfies assignment requirements. Output is co
ect and program code follows assignment instructions.
    Name and Lab Number included in program output (your System.out statement should be the first statement in main()).    5%    100%    4.0
    Code is well documented (meaningful identifiers and comments).    5%    100%    4.0
    Code is well formatted.    5%    100%    4.0
    Replaced instance variables hour, minute, and second with a single instance variable called totalSeconds    15%    100%    12.0
    Constructors use setTime() and setTime() uses setHour(), setMinute(), and setSecond() to set the time using totalSeconds.    25%    100%    20.0
    getters modified to work with totalSeconds only and demonstrated by being used in the problem solution.    20%    100%    16.0
    The above changes have been made and the output of Time2Test.java is the same after the changes as it was before the changes (new output should include the student's name and lab number).    25%    100%    20.0
    Total    100%        80.0
Feedback
    WellDone    Well done :). You met the requirements of the assignment creatively, applying the lessons learned from this week's reading. Keep up the good work.
    Good    Good job. You met most of the requirements of the assignment creatively, applying the lessons learned from this week's reading. See the rest of my comments below.
    NotGood    Please see my comments below. Here is a link to a Word document with tips, links, tutorials, and tutors to help you get back on track: https:
www.dropbox.com/s/gkk59be5mg2wdso/Java%20Help%20for%20Struggling%20Students.docx?dl=0
    DidNotSee    I didn't see this :(.
    PoorlyFormatted    Your code was very poorly formatted making it very hard to read. See the author's examples in your text for proper formatting guidance.
Sheet3
Answered Same Day Mar 28, 2022

Solution

Aditya answered on Mar 29 2022
110 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here