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 »
use intellij IDEA


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 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. 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 current 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 correct 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: // -- brief statement as to the file’s purpose //CSIS 312-

// -- 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. b. 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 correct 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 Rubric Modify a Class Implementation Assignment Grading Guide80<- 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="" correctly="" 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="" correct="" 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.="">
Answered Same DayMar 28, 2022

Answer To: CSIS 312 Modify a Class Implementation Assignment Instructions Using the Time2.java and...

Aditya answered on Mar 29 2022
119 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