Public Relations
May 17, 2022
week 3 Discusion 2
May 17, 2022
Show all

CMIS 242

 

1. Model a real-life object as a Java class with at least one attribute and an instance method. Write a main method to create an instance of the class, assign a value to the attribute, call your method, and demonstrate that the value of the attribute changed and that the method successfully completed what it was supposed to do. The main method can be created in a separate driver class (e.g. MyDriver.java) within which you will create an instance of the object class. For example, if the name of the object class is Car (meaning, you are coding Car.java) then you can create an instance of Car inside MyDriver.java.

Be sure to create a program different from any of the programs already posted by your classmates or the examples in-class materials.

2. Reply to another student’s post. Modify the students class to add another attribute and a method that fits (is consistent with) the object the class is modeling, or suggest a different version of the code. Write the main method to demonstrate the correct functionality of the additions. As you reply to the other students, try to reply to a post that does not have a reply yet, and if not; try to reply to a post with a fewer number of replies.

Be sure to create a program different from any of the programs already posted by your classmates or the examples in the class materials.

As you answer these questions, use proper Java naming convention (Camel case), name the class, attribute, and method in a meaningful way to represent the business meaning, and add comments to the Java code as applicable.

The deliverables are the Java code and the documentation. The documentation is a single Microsoft Word document, or PDF containing the screenshot of the results obtained by running the code. 

Leave a Reply

Your email address will not be published. Required fields are marked *