<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>CS360 - archive</title><link href="https://lums-cs360-web.github.io/lums-cs360/" rel="alternate"/><link href="https://lums-cs360-web.github.io/lums-cs360/feeds/archive.atom.xml" rel="self"/><id>https://lums-cs360-web.github.io/lums-cs360/</id><updated>2024-11-07T00:00:00+05:00</updated><subtitle>Copyright @ CMPUT301 - University of Alberta</subtitle><entry><title>Old Lecture Recordings Fall 2020</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/fall_lab_recordings_2020.html" rel="alternate"/><published>2024-11-07T00:00:00+05:00</published><updated>2024-11-07T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-11-07:/lums-cs360/archive/fall_lab_recordings_2020.html</id><summary type="html">&lt;p&gt;Old Lecture Recordings 2020 Fall&lt;/p&gt;</summary><content type="html"/><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="videos"/></entry><entry><title>Old Lecture Recordings Fall 2021</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/fall_lab_recordings_2021.html" rel="alternate"/><published>2024-11-07T00:00:00+05:00</published><updated>2024-11-07T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-11-07:/lums-cs360/archive/fall_lab_recordings_2021.html</id><summary type="html">&lt;p&gt;Old Lecture Recordings 2021 Fall&lt;/p&gt;</summary><content type="html"/><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="videos"/></entry><entry><title>Course Outline Winter 2024</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/outline-w24.html" rel="alternate"/><published>2024-11-05T00:00:00+05:00</published><updated>2024-11-05T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-11-05:/lums-cs360/archive/outline-w24.html</id><summary type="html">&lt;p&gt;Lecture, Labs, Contact Information, Lecturer, Teaching Assistants, Course Content, Course Description, Prerequisites, Objectives and Learning Outcomes, Course Topics, Learning Resources, Course Schedule, Required Textbook and/or Other Major Course Materials, Recommended or Optional Learning Resources, Course Fees, On-Line Homework Disclaimer, Academic Success Centre, Faculty of Science Student Services, Grade Evaluation, Letter Grades, Statement of Expectations for AI Use, Re-Evaluation of Term Work, Re-examination, Past or Representative Evaluative Material, Labs, Participation, Policies for Late and Missed Work, Late Policy, Non-medical Protected Grounds, Missed Term Work: Assignments, Labs, Quizzes, Project Parts, Midterm Exams, Missed Term Work: Participation, Deferred Final Examination, Required Technology, Labs Assignments and Project, Lecture Participation, Remote Delivery Considerations, Technology Requirements, Recordings of Synchronous Activities, Home-Based Lab Activities, Student Resources for Remote Learning, Student Responsibilities, Academic Integrity and Student Conduct, Contract Cheating and Misuse of University Academic Materials or Other Assets, Contract Cheating: CS Courses, Academic Integrity Issues Related to Minor Formative Assessments, Appropriate Collaboration, Citation, Solo Effort: Participation Exercises, Quizzes, Exams, Confidential: Exams, Consultation: Assignments, Labs, Teamwork: Group Projects, Intellectual Violence, Exam Conduct, Lecture Conduct, Students Eligible for Accessibility-Related Accommodations, Recording and/or Distribution of Course Materials, On-Campus Computer Labs, Recording and/or Distribution of Course Materials, Learning and Working Environment, Feeling Stressed, Anxious, or Upset?, Student Self-Care Guide, Land Acknowledgement, Administrative, Policy about Course Outlines, Disclaimer, Update History, Copyright&lt;/p&gt;</summary><content type="html">&lt;h2 class="western"&gt;General Information&lt;/h2&gt;
&lt;p&gt;Term: Winter 2024&lt;br&gt;Number of credits: 3 credits&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lecture (E)B1&lt;/strong&gt;&lt;br&gt;Date and Time: Monday-Wednesday-Friday, 10:00-10:50 MT&lt;br&gt;Location: C E1-60&lt;br&gt;&lt;span style="font-size: 14px;"&gt;Instructor: Dr. Abram Hindle&lt;/span&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 14px;"&gt;&lt;strong&gt;Lecture (E)B2&lt;/strong&gt;&lt;br&gt;Date and Time: Monday-Wednesday-Friday, 11:00-11:50 MT&lt;br&gt;Location: ETLC E1-017&lt;br&gt;&lt;span&gt;Instructor: Dr. Hazel Campbell&lt;/span&gt;&lt;br&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Labs start in the FIRST week of classes.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lab (E)H01&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Date and Time: Tuesday, 17:00-19:50&lt;br&gt;Location: ETLC E1-013&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lab (E)H02&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Date and Time: Wednesday, 17:00-19:50&lt;br&gt;Location: ETLC E1-0003&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lab (E)H03&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Date and Time: Thursday, 17:00-19:50&lt;br&gt;Location: CCIS 1-140&lt;br&gt;&lt;/p&gt;
&lt;p&gt;See&amp;nbsp;&lt;a href="https://eclass.srv.ualberta.ca/mod/page/view.php?id=8037436"&gt;Contact Information&lt;/a&gt;&amp;nbsp;for details about your instructor and teaching assistants.&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;script language="JavaScript"&gt;&lt;/script&gt;
&lt;p&gt;&lt;a&gt;&lt;span lang="EN"&gt;Policy about course outlines &lt;/span&gt;&lt;/a&gt;&lt;span lang="EN"&gt;&lt;a id="_anchor_1" onmouseover="msoCommentShow('_anchor_1','_com_1')" onmouseout="msoCommentHide('_com_1')" href="#_msocom_1" language="JavaScript" name="_msoanchor_1"&gt;&lt;/a&gt;can be found in &lt;a href="https://calendar.ualberta.ca/content.php?catoid=36&amp;amp;navoid=11176#course-requirements-evaluation-procedures-and-grading" target="_blank"&gt;Course Requirements, Evaluation Procedures and Grading&lt;/a&gt;
        of the University Calendar.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
    &lt;div&gt;

        &lt;div id="_com_1" language="JavaScript" onmouseover="msoCommentShow('_anchor_1','_com_1')" onmouseout="msoCommentHide('_com_1')"&gt;&lt;a name="_msocom_1"&gt;&lt;/a&gt;

            &lt;p&gt;&lt;span lang="EN"&gt;This statement is required verbatim, as per
                    Calendar regulations.&lt;/span&gt;&lt;/p&gt;

        &lt;/div&gt;

    &lt;/div&gt;

&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Disclaimer: Any errors in this Course Outline and Course Policy are subject to change and will be announced in class. The date of the final examination is set by the Registrar and takes precedence over the final examination date reported in this syllabus.&lt;br&gt;&lt;/p&gt;
&lt;h2 class="western"&gt;Overview&lt;/h2&gt;
&lt;p&gt;As an introduction to software engineering, this course is about building software effectively. You will apply good practices, effective design techniques, and development tools within a team project to create an application with a graphical user interface.&lt;/p&gt;
&lt;p&gt;The focus is largely practical, with broad coverage in topics such as: object-oriented design, user interfaces, unit testing, design patterns, and refactoring.&lt;/p&gt;
&lt;p&gt;Communication skills, team dynamics, working with a "customer", and creativity are also important factors in the course project. The knowledge, skills, and experience you gain will be invaluable in your future software development projects.&lt;/p&gt;
&lt;h2 class="western"&gt;Objectives&lt;/h2&gt;
&lt;p&gt;We will learn about applying software engineering concepts to design and implement interactive applications.&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;One effective way to build such applications is to apply object-oriented design and use software components. To be useful to end users, the design of these applications must also be guided by usability principles. The course involves a team project in
    building a well-designed Java/Android application with a sophisticated graphical user interface.&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;By the end of this course, you will have a strong background in basic software engineering concepts. Also, you will have the skills to implement interactive applications in Android. You will learn to propose and think critically about software and user
    interface designs.&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;Students are expected to participate in all classes and labs.&lt;/p&gt;
&lt;h2 class="western"&gt;Pre-requisites&lt;/h2&gt;
&lt;p&gt;CMPUT 201 or 275&lt;/p&gt;
&lt;h2 class="western"&gt;Course Topics&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Software engineering:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;
        &lt;p style="margin-bottom: 0cm;"&gt;object-oriented analysis and development&lt;br&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;p style="margin-bottom: 0cm;"&gt;Unified Modeling Language&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;p style="margin-bottom: 0cm;"&gt;software processes&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;p style="margin-bottom: 0cm;"&gt;requirements&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;p style="margin-bottom: 0cm;"&gt;testing&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;p style="margin-bottom: 0cm;"&gt;design patterns&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;p style="margin-bottom: 0cm;"&gt;refactoring&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;p style="margin-bottom: 0cm;"&gt;tools&lt;/p&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;p&gt;revision control&lt;/p&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;h2 class="western"&gt;Course Work and Evaluation&lt;/h2&gt;
&lt;p&gt;&lt;span class="" style="color: rgb(255, 44, 54);"&gt;All assignments and project parts are due at 16:00 MT on the due date.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="" style="color: rgb(255, 44, 54);"&gt;Exams are in-person. Exercises are in person. Midterms are in person.&lt;br&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In the labs, the TAs will explain the submission process for lab exercises (typically online). Late submissions will not be accepted.&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;Note the rightmost column below, which shows collaboration models for each unit of course work. These models are described on the CS course policy page: &lt;br&gt;&lt;/p&gt;
&lt;pre wrap=""&gt;&lt;a href="https://www.ualberta.ca/computing-science/resources/policy-information/department-course-policies.html" target="_blank"&gt;https://www.ualberta.ca/computing-science/resources/policy-information/department-course-policies.html&lt;/a&gt;&lt;/pre&gt;
&lt;pre wrap=""&gt;&lt;br&gt;&lt;/pre&gt;

&lt;table style="width: 550px;" cellspacing="0" cellpadding="2"&gt;
    &lt;colgroup&gt;
        &lt;col width="110"&gt;
        &lt;col width="164"&gt;
        &lt;col width="59"&gt;
        &lt;col width="114"&gt;
        &lt;col width="83"&gt;
    &lt;/colgroup&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td rowspan="6" style="border: 1px solid #000000; padding: 0.05cm;" width="110"&gt;
                &lt;p&gt;Individual Work&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Assignment 0&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;required&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;January 22&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Consultation&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Assignment 1&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;8%&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;February 5&lt;br&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Consultation&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Participation&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;7%&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;throughout&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Consultation&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Midterm Exam 1&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;15%&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;January 31&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Solo Effort&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Midterm Exam 2&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;15%&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;March 4&lt;br&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Solo Effort&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Midterm Exam 3&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;15%&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;April 3&lt;br&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Solo Effort&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td rowspan="5" style="border: 1px solid #000000; padding: 0.05cm;" width="110"&gt;
                &lt;p&gt;Team Work&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Project Part 0&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;required&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;January 22&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Teamwork&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Project Part 1&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;required&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;February 5&lt;br&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Teamwork&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Project Part 2&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;8%&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;February 16&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Teamwork&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Project Part 3&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;12%&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;March 8&lt;br&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Teamwork&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;
                &lt;p&gt;Project Part 4&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;
                &lt;p&gt;20%&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;
                &lt;p&gt;April 8&lt;br&gt;&lt;/p&gt;
            &lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;
                &lt;p&gt;Teamwork&lt;/p&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td rowspan="5" style="border: 1px solid #000000; padding: 0.05cm;" width="110"&gt;&amp;nbsp;&lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="164"&gt;&amp;nbsp;&lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="59"&gt;100%&lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="114"&gt;&amp;nbsp;&lt;/td&gt;
            &lt;td style="border: 1px solid #000000; padding: 0.05cm;" width="83"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;

    &lt;/tbody&gt;
&lt;/table&gt;

&lt;p class="western" style="font-weight: normal;" lang="pl-PL"&gt;&lt;strong&gt;&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class="western" style="" lang="pl-PL"&gt;&lt;span style=""&gt;Reading break: Feb 19-23&lt;br&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="western" style="font-weight: normal;" lang="pl-PL"&gt;&lt;strong&gt;Exams:&lt;/strong&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span color="#ff0000" class="" style="color: rgb(255, 44, 54);"&gt;* There is no possibility of a reexamination in this course for midterms 1 and 2.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span color="#ff0000" class="" style="color: rgb(255, 44, 54);"&gt;* Midterm 3 has a deferred oral exam. If you miss Midterm 3, you will have to do an oral exam.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;There is NO Final exam.&lt;/strong&gt;
&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In the midterm exams, you will be asked to code, diagram, write, describe and draw solutions to software engineering problems.&lt;br&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;p class="western"&gt;&lt;strong&gt;Grade Evaluation:&lt;/strong&gt;&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The individualized project score depends on the following main factors: how well your team did, the peer review forms of your team members, your completion of peer review forms, and the instructor and TAs' assessment of your individual contribution.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The conversion of your total numeric coursework score to a final grade will be based on interpreting the guidelines of the descriptors, letter grading system, and four-point scale as defined in the University Calendar&amp;nbsp;&lt;a href="http://www.registrar.ualberta.ca/calendar/Regulations-and-Information/Academic-Regulation/23.4.html#23.4" target="_blank"&gt;§23.4&lt;/a&gt;. That is, grades are assigned on what we judge to be "failure", "minimal pass", "poor", "satisfactory", "good", or "excellent" performance in the context of the class.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We do not use a particular distribution to do the conversion, but instead use our judgement of how your score reflects mastery of the course material. Obtaining 50 course marks or more guarantees a passing grade of at least D. Obtaining 90 course marks or more guarantees a grade of at least A-.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p dir="ltr" id="docs-internal-guid-c76e51f8-7fff-7040-2973-644c442d0960"&gt;Grades are unofficial until approved by the Department and/or Faculty offering the course.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 27px; font-weight: bold;"&gt;Course Materials&lt;/span&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;This course does not have a required textbook. There are a number of excellent resources for this course, available as electronic books or through open access on the Web. See the course eClass site for links.&lt;/p&gt;
&lt;p&gt;Images reproduced in lecture slides have been included under section 29 of the Copyright Act, as fair dealing for research, private study, criticism, or review. Further distribution or uses may infringe copyright on these images.&lt;/p&gt;
&lt;p&gt;In addition to fair dealing, the Copyright Act specifically exempts &lt;i&gt;projected displays&lt;/i&gt; by educational institutions for the purposes of education or training on the &lt;i&gt;premises&lt;/i&gt; of the education institution.&lt;/p&gt;
&lt;p&gt;Copyright regulations, however, prohibit me from distributing &lt;i&gt;complete copies&lt;/i&gt; of the lecture slides on the course eClass site.&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;You may assume that any code examples we provide to you are public domain and free for you to take without attribution, unless they are licensed.&lt;/p&gt;
&lt;p&gt;Please see the exam pages when posted for representative example questions.&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 class="western"&gt;Academic Integrity&lt;/h2&gt;
&lt;p&gt;The University of Alberta is committed to the highest standards of academic integrity and honesty. Students are expected to be familiar with these standards regarding academic honesty and to uphold the policies of the University in this respect. Students
    are particularly urged to familiarize themselves with the provisions of the Code of Student Behaviour (online at &lt;a href="http://www.governance.ualberta.ca" target="_blank"&gt;www.governance.ualberta.ca&lt;/a&gt;) and avoid any behaviour which could potentially
    result in suspicions of cheating, plagiarism, misrepresentation of facts and/or participation in an offence. Academic dishonesty is a serious offence and can result in suspension or expulsion from the University. (GFC 29 SEP 2003)&lt;/p&gt;
&lt;h2 class="western"&gt;Course Policies&lt;/h2&gt;
&lt;p&gt;Please see the &lt;a href="https://eclass.srv.ualberta.ca/mod/page/view.php?id=8037434"&gt;Course Policies&lt;/a&gt; specific to CMPUT 301.&lt;/p&gt;
&lt;p&gt;Most course policies are determined by the Department of Computing Science. See the following page&lt;a href="https://www.cs.ualberta.ca/resources-services/policy-information/department-course-policies"&gt;&lt;/a&gt; for general information on CS course policies.&lt;/p&gt;
&lt;pre wrap=""&gt;&lt;a href="https://www.ualberta.ca/computing-science/resources/policy-information/department-course-policies.html" target="_blank"&gt;https://www.ualberta.ca/computing-science/resources/policy-information/department-course-policies.html&lt;/a&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;</content><category term="archive"/><category term="outline"/><category term="policy"/><category term="grading"/><category term="contact"/></entry><entry><title>Class Participation Exercise 18</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer18.html" rel="alternate"/><published>2024-10-24T00:00:00+05:00</published><updated>2024-10-24T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-10-24:/lums-cs360/archive/class_participation_exer18.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 18&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation.&lt;/p&gt;
&lt;p&gt;Which of these code smells are signs of "bloat", i.e., code, methods, and classes that have increased to an extent that they become hard to work with.
  - [ ] comments
  - [ ] duplicated code
  - [ ] long method
  - [ ] large class
  - [ ] data classes
  - [ ] data clumps
  - [ ] large parameter list
  - [ ] divergent change
  - [ ] shotgun surgery
  - [ ] feature envy
  - [ ] inappropriate intimacy
  - [ ] message chains
  - [ ] primitive obsession
  - [ ] switch statements
  - [ ] speculative generality
  - [ ] refused bequest&lt;/p&gt;
&lt;p&gt;Which of these code smells are signs of incomplete or incorrect use of object-oriented design principles?
  - [ ] comments
  - [ ] duplicated code
  - [ ] long method
  - [ ] large class
  - [ ] data classes
  - [ ] data clumps
  - [ ] large parameter list
  - [ ] divergent change
  - [ ] shotgun surgery
  - [ ] feature envy
  - [ ] inappropriate intimacy
  - [ ] message chains
  - [ ] primitive obsession
  - [ ] switch statements
  - [ ] speculative generality
  - [ ] refused bequest&lt;/p&gt;
&lt;p&gt;Which of these code smells are signs that change is difficult and likely expensive?
  - [ ] comments
  - [ ] duplicated code
  - [ ] long method
  - [ ] large class
  - [ ] data classes
  - [ ] data clumps
  - [ ] large parameter list
  - [ ] divergent change
  - [ ] shotgun surgery
  - [ ] feature envy
  - [ ] inappropriate intimacy
  - [ ] message chains
  - [ ] primitive obsession
  - [ ] switch statements
  - [ ] speculative generality
  - [ ] refused bequest&lt;/p&gt;
&lt;p&gt;Which of these code smells are signs of something unnecessary, which if avoided would lead to cleaner, more efficient, and easier to understand code?
  - [ ] comments
  - [ ] duplicated code
  - [ ] long method
  - [ ] large class
  - [ ] data classes
  - [ ] data clumps
  - [ ] large parameter list
  - [ ] divergent change
  - [ ] shotgun surgery
  - [ ] feature envy
  - [ ] inappropriate intimacy
  - [ ] message chains
  - [ ] primitive obsession
  - [ ] switch statements
  - [ ] speculative generality
  - [ ] refused bequest&lt;/p&gt;
&lt;p&gt;Which of these code smells are signs of excessive coupling between classes?
  - [ ] comments
  - [ ] duplicated code
  - [ ] long method
  - [ ] large class
  - [ ] data classes
  - [ ] data clumps
  - [ ] large parameter list
  - [ ] divergent change
  - [ ] shotgun surgery
  - [ ] feature envy
  - [ ] inappropriate intimacy
  - [ ] message chains
  - [ ] primitive obsession
  - [ ] switch statements
  - [ ] speculative generality
  - [ ] refused bequest&lt;/p&gt;
&lt;p&gt;Consider the following piece of code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;// Order.java&lt;/span&gt;

&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;com.nq.util&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.io.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.util.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.lang.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Order&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineitemlist&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItemList&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lineitemlist&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;lineItemList&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lis&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;aThat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;aThat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;aThat&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;instanceof&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;Order&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;that&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;aThat&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;lineItemList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;that&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;lineItemList&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// writes this order object to the specified print writer&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;writeOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Order&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PrintWriter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// get a vector of line items&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;Vector&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getLineItemList&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="na"&gt;getLineItems&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// ------------------------------------------------------&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// calculate total&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// ------------------------------------------------------&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// create an iterator for the vector&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;Iterator&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;lineItem&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// set total to zero&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hasNext&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lineItem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="c1"&gt;// calculate total for line item&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;unitPrice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getUnitPrice&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getQuantity&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineitemtotal&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;unitPrice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineitemtotal&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// ------------------------------------------------------&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// END calculate total&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// ------------------------------------------------------&lt;/span&gt;

&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// ------------------------------------------------------&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// write order&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// ------------------------------------------------------&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// create an iterator for the vector&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hasNext&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lineItem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="c1"&gt;// calculate total for line item&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;unitPrice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getUnitPrice&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getQuantity&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;productID&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getProductID&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;imageID&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getImageId&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineitemtotal&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;unitPrice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;pw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Begin Line Item&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;pw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Product = &amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;productID&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;pw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Image = &amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;imageID&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;pw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Quantity = &amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;pw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Total = &amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineitemtotal&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;pw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;End Line Item&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;pw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Order total = &amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getTotal&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// get a vector of line items&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;Vector&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItemList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getLineItems&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// create an iterator for the vector&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;Iterator&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;lineItem&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// set total to zero&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hasNext&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lineItem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;iterator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="c1"&gt;// calculate total for line item&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;unitPrice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getUnitPrice&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getQuantity&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineitemtotal&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;unitPrice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineitemtotal&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// lineitemlist.java&lt;/span&gt;

&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;com.nq.util&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.io.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.util.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.lang.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;lineitemlist&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Vector&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;LIList&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setLineItems&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Vector&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;LIList&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;Vector&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getLineItems&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;LIList&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// lineItem.java&lt;/span&gt;

&lt;span class="kn"&gt;package&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;com.nq.util&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.io.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.util.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;java.lang.*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;lineItem&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;protected&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;productId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ImageID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Unitprice&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;lineItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;prodID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ImageID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;inQty&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;productId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;prodID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ImageID&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ImageID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;inQty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setLineItems&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Vector&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;LineItems&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lineItems&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;Vector&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getLineItems&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;LineItems&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getProductID&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;productId&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getImageID&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;imageID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getQuantity&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getUnitPrice&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Unitprice&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setProductID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;productId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setImageID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;imageID&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setQty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;qty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;qty&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setUnitPrice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;Unitprice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;What code smells are evident? For each, briefly describe its occurrence(s) in the code.&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "comments" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "duplicated code" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "long method" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "large class" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "data classes" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "data clumps" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "large parameter list" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "divergent change" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "shotgun surgery" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "feature envy" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "inappropriate intimacy" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "message chains" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "primitive obsession" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "switch statements" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "speculative generality" code smell:&lt;/p&gt;
&lt;p&gt;Occurrence(s) of "refused bequest" code smell:&lt;/p&gt;
&lt;p&gt;Other occurrence(s) of inconsistent or nonstandard coding:&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>A1/A2 20th September Class Exercise</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_sept20.html" rel="alternate"/><published>2024-10-17T00:00:00+05:00</published><updated>2024-10-17T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-10-17:/lums-cs360/archive/class_participation_exer_sept20.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise Sept 20&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Based on the UML, write some Java classes that implement the structure described by the UML. First, implement the class structure. Then add attributes/methods to each class for the relationships (association/aggregation/composition) that enforce the multiplicities. The fields and methods are missing from the UML, but you need to add code to each class for the methods and attributes shown in the relationships. If you have time, you can add other reasonable methods and attributes as well.&lt;/p&gt;
&lt;div style="text-align: center; margin: 20px;"&gt;
    &lt;img src="https://lums-cs360-web.github.io/lums-cs360/archive/sept20exer.png" alt="Participation Exercise Image" 
    style="width: 800px;"&gt;
&lt;/div&gt;

&lt;p&gt;Add your name and your partner's name (if you have one) to the code. If you don't add your name, you will receive a zero.  &lt;/p&gt;
&lt;p&gt;Either upload your java code as a single file or take a picture or screenshot and upload it.&lt;br&gt;
- &lt;a href="https://lums-cs360-web.github.io/lums-cs360/archive/car_exer_sept20.pdf"&gt;car.pdf&lt;/a&gt;&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>A1/A2 2nd October Class Exercise</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_oct2.html" rel="alternate"/><published>2024-10-17T00:00:00+05:00</published><updated>2024-10-17T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-10-17:/lums-cs360/archive/class_participation_exer_oct2.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise Oct 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Java code below is software for a tiny sound recorder used by spies. It has a physical hardware counter display to show how much recording time is left and a button that starts it recording and stops it.&lt;br&gt;
Refactor/Restructure this single class into MVC classes as a UML diagram. You do not need to diagram the original code, you only need to make a UML class diagram for your new MVC version of the code. Only refactor the code shown. You do not need to include the TimeCounter or Microphone classes in your UML, because they are static hardware that you cannot change or reprogram.&lt;br&gt;
On the diagram, clearly label which classes represent model, view, and controller. Your UML class diagram should have all the basic abstractions, attributes, methods, relationships, multiplicities, and navigabilities as appropriate. “...” means much code is omitted.&lt;br&gt;
Use the “active model” type of MVC that we discussed in class: the one that uses the observer pattern.&lt;br&gt;
Do not submit Java, submit UML.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SpyCorder&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ArrayList&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Sounds&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;recording&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;SpyCorder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;enabled&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;runLoop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;runLoop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;recording&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Microphone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;showRemaining&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;buttonPressed&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;enabled&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;showRemaining&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;TimeCounter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;show&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;recording&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Add your name and your partner's name (if you have one) to the diagram. If you don't, you won't get credit.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Upload a screenshot. If you worked in a pair, get the screenshot from your partner and upload the same screenshot.&lt;/p&gt;
&lt;p&gt;You can screenshot a diagrammer of your choice, or draw it on paper and take a photo.
Here's a handy diagrammer online: https://app.diagrams.net/ IF that one doesn't work for you, try a different one.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>A1/A2 Sept 23rd Class Exercise</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_sept23.html" rel="alternate"/><published>2024-10-17T00:00:00+05:00</published><updated>2024-10-17T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-10-17:/lums-cs360/archive/class_participation_exer_sept23.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise Sept 23&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Based on the Java code, design a UML class diagram that represents the structure of this these classes. Pay special attention to the relationships and their multiplicities (the 1 or 0..&lt;em&gt; or 1..&lt;/em&gt; etc.).&lt;/p&gt;
&lt;p&gt;Add your name and your partner's name (if you have one) to the diagram.
&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Upload a screenshot. If you worked in a pair, get the screenshot from your partner and upload the same screenshot.
&lt;br&gt;&lt;/p&gt;
&lt;p&gt;You can screenshot a diagrammer of your choice, or draw it on paper and take a photo.&lt;/p&gt;
&lt;p&gt;Do not change file extension without converting in a conversion application, you will make the file unreadable by eclass and get a zero. &lt;strong&gt;For example, renaming a file from .heif or .heic to .png will make it unreadable and you will get a zero.&lt;/strong&gt; Instead, open it in a conversion tool like preview and export it as a different file format.&lt;/p&gt;
&lt;p&gt;Here's a handy diagrammer online: https://app.diagrams.net/ IF that one doesn't work for you, try a different one. I use umlet personally, which you have to download and install. https://www.umlet.com/&lt;/p&gt;
&lt;p&gt;Here's the Java code:
&lt;a href="https://lums-cs360-web.github.io/lums-cs360/archive/class_par_sept23_code.zip"&gt;code&lt;/a&gt;&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 10</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer10.html" rel="alternate"/><published>2024-10-15T00:00:00+05:00</published><updated>2024-10-15T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-10-15:/lums-cs360/archive/class_participation_exer10.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 10&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation. An answer will be discussed in class.&lt;/p&gt;
&lt;p&gt;You want a GPS device to disable itself temporarily if it detects it is going faster than 200 km/h. Write the code for a mock object (class MockLocation) that will allow running of bolded lines of class PersonTracker in method testTooFast of class TestPersonTracker.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PersonTracker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lastLocation&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// called every second&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;updateLocation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;throws&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;GPSException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lastLocation&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lastLocation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;200.0&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;3600&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="c1"&gt;// 200 km/h in m/s&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;GPS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getGPS&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="na"&gt;disable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="k"&gt;throw&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;GPSException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Too Fast!&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;lastLocation&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// distance in metres&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TestPersonTracker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;extends&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;TestCase&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;testTooFast&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;PersonTracker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PersonTracker&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;MockLocation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;updateLocation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;updateLocation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;fail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;This was supposed to throw exception.&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;GPSException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// exception was properly thrown&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;State any assumptions. You should try to avoid modifying the given code.&lt;/p&gt;
&lt;p&gt;Submit your Java code in a zip file.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>A1/A2 18th September Class Exercise</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_sept18.html" rel="alternate"/><published>2024-10-08T00:00:00+05:00</published><updated>2024-10-08T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-10-08:/lums-cs360/archive/class_participation_exer_sept18.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise Sept 18&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Imagine a mobile application designed for the world of Dungeons &amp;amp; Dragons (D&amp;amp;D). This application serves as a tool for managing and tracking character stats, and creating and customizing D&amp;amp;D characters. It keeps track of stats such as strength, dexterity, constitution, intelligence, wisdom, and charisma.&lt;/p&gt;
&lt;p&gt;There is a spell management system. In the context of D&amp;amp;D, a spell is a magical effect conjured by a character. Each spell has specific effects, casting time, range, and duration. A spellbook is a collection of spells that a character knows and can use during gameplay. The application allows users to add or remove spells from their character’s spellbook, effectively managing their repertoire of spells.&lt;/p&gt;
&lt;p&gt;The concept of spell slots represents the energy a character has to cast spells. Each spell requires a certain level of energy, represented by the level of the spell slot. The application tracks the usage of these spell slots, helping users manage their character’s magical energy efficiently.&lt;/p&gt;
&lt;p&gt;The application also monitors the character’s health through hit points, tracks their progress through experience points.&lt;/p&gt;
&lt;p&gt;A key feature of this application is its detailed inventory management system. In the context of D&amp;amp;D, a character’s inventory can include a wide range of items. These can be weapons like swords and bows, armor like shields and helmets, adventuring gear like ropes and torches, tools like thieves’ tools and musical instruments, and even magic items like potions and scrolls. The application allows users to add or remove items from their character’s inventory, effectively managing their collection of items.&lt;/p&gt;
&lt;p&gt;The inventory management system also keeps track of the weight of the items, as carrying too many heavy items can slow a character down. It provides detailed information about each item, such as its properties, value, and description.&lt;/p&gt;
&lt;p&gt;One special item that can be managed in the inventory is the “Bag of Holding”. In D&amp;amp;D, a Bag of Holding is a magical item that can hold more items than its size would suggest. It’s a small sack, but its inside is larger than its outside dimensions. Regardless of what is put into the bag, it weighs a fixed amount. This makes it highly valuable for characters carrying many items. The application should be able to handle such special items and their unique properties.&lt;/p&gt;
&lt;p&gt;Based on this description, design a UML class diagram that represents the structure of this application. Consider the classes, their attributes, methods, and relationships.&lt;/p&gt;
&lt;p&gt;Add your name and your partner's name (if you have one) to the diagram. If you do not put your name on the file you will get a zero.&lt;/p&gt;
&lt;p&gt;Upload a screenshot. If you worked in a pair, get the screenshot from your partner and upload the same screenshot.&lt;/p&gt;
&lt;p&gt;You can screenshot a diagrammer of your choice, or draw it on paper and take a photo, or you can draw it with a tablet.&lt;/p&gt;
&lt;p&gt;Here are some free diagrammers:&lt;/p&gt;
&lt;p&gt;Here's a handy diagrammer online: &lt;em&gt;https://app.diagrams.net/&lt;/em&gt;&lt;br&gt;
IF that one doesn't work for you, try a different one.&lt;br&gt;
Here's a Java one: &lt;em&gt;https://www.umlet.com/changes.htm&lt;/em&gt; (download the stand alone)&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>B2 27th March Class Exercise</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_march27.html" rel="alternate"/><published>2024-10-08T00:00:00+05:00</published><updated>2024-10-08T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-10-08:/lums-cs360/archive/class_participation_exer_march27.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Design and create a sequence diagram for a system that allows users to customize a car using the decorator pattern. It might be helpful to sketch the class diagram, but it's not required, only the sequence diagram is required.&lt;/p&gt;
&lt;p&gt;Use the decorator pattern to implement a simulator, a car and some upgrades that can be applied to the car. The car has some basic properties like model, color, speed, and price. A variety of upgrades are available such as a V8 engine, a turbocharger, a spoiler, and racing tires.&lt;/p&gt;
&lt;p&gt;Make a sequence diagram that shows the interaction between the objects when it constructs a car with at least 2 upgrades and then computes its price.&lt;/p&gt;
&lt;p&gt;Do not submit Java, submit UML &lt;strong&gt;Sequence Diagram&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Add your name and your partner's name (if you have one) to the diagram. If you don't, you won't get credit.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Upload a screenshot. If you worked in a pair, get the screenshot from your partner and upload the same screenshot.&lt;/p&gt;
&lt;p&gt;You can screenshot a diagrammer of your choice, or draw it on paper and take a photo.
Here's a handy diagrammer online: https://app.diagrams.net/ IF that one doesn't work for you, try a different one.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise Sequence Diagram</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_march24_sequence.html" rel="alternate"/><published>2024-09-25T00:00:00+05:00</published><updated>2024-09-25T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-25:/lums-cs360/archive/class_participation_exer_march24_sequence.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise March 24 - Sequence Diagram&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation. An answer will be discussed in class.&lt;/p&gt;
&lt;p&gt;Consider the basic command design pattern, with Invoker, ConcreteCommand, and Receiver classes. Assume also there is a Client class to create a ConcreteCommand object and bind it to an Invoker object via dependency injection.&lt;/p&gt;
&lt;p&gt;Draw the UML sequence diagram that depicts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the command creation and its binding to an invoker, and&lt;/li&gt;
&lt;li&gt;the behavior of the command pattern to have the invoker execute the command, which runs an action on a receiver&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Submit your sequence diagram as a PDF, PNG, or JPEG file.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise (Cohesion and Coupling)</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_cohesion_coupling.html" rel="alternate"/><published>2024-09-21T00:00:00+05:00</published><updated>2024-09-21T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-21:/lums-cs360/archive/class_participation_cohesion_coupling.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise: Cohesion and Coupling&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;For the first set of UML diagrams which one has more coupling CarA or CarB?&lt;/li&gt;
&lt;li&gt;For the second set of UML diagrams (spaceship) which one has the most coupling?&lt;/li&gt;
&lt;li&gt;Out of all these classes, which classes are the least Cohesive?&lt;/li&gt;
&lt;li&gt;Out of all these classes, which classes are the most Cohesive?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt="Image" src="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_cohesion_coupling.png"&gt;&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise (CRC Cards)</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_crc.html" rel="alternate"/><published>2024-09-21T00:00:00+05:00</published><updated>2024-09-21T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-21:/lums-cs360/archive/class_participation_crc.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise: CRC Cards&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Instructions:&lt;/strong&gt; You are tasked with the Object Oriented Analysis (OOA) of the following problem. Please make CRC cards (Class Reponsibility Collaboration) for each meaningful class.&lt;/p&gt;
&lt;p&gt;I want to see if a skin-blemish changes over time. To prove that a blemish changes I need evidence (photos). I would like to take photos of these blemishes over time and store them in a safe place. I want the photos to be taken consistently. These photos can be provided to physicians when needed.&lt;/p&gt;
&lt;p&gt;Example format:&lt;/p&gt;
&lt;p&gt;Class: UFO
Collaborator: Alien, Earthling
Responsibility: Provide an Earthling abduction platform
Responsibility: Carry Aliens&lt;/p&gt;
&lt;p&gt;Class: Earthling
Collaborator: Alien, UFO
Responsibility: Abductee
Responsibility: To be mind probed&lt;/p&gt;
&lt;p&gt;Class: Cow
Collaborator: Alien, UFO
Responsibility: Abductee
Responsibility: To be mind probed
Generalization: Earthling&lt;/p&gt;
&lt;p&gt;Repeat this format for each class you think is relevant.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise (Git)</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_git.html" rel="alternate"/><published>2024-09-21T00:00:00+05:00</published><updated>2024-09-21T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-21:/lums-cs360/archive/class_participation_git.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;CMPUT301 Exercise: GIT Stuff you should know!&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Q1: I committed a big mistake, I want to restore my repository to the prior commit, what should I run?&lt;/li&gt;
&lt;li&gt;Q2: I want to record a change locally, what do I run?&lt;/li&gt;
&lt;li&gt;Q3: How do I share my changes?&lt;/li&gt;
&lt;li&gt;Q4: How do I get my colleagues changes?&lt;/li&gt;
&lt;li&gt;Q5: How do you checkout commit, 9a4c3ef1630e13ced5b5a34faaa70d82c3634138 as a new branch?&lt;/li&gt;
&lt;/ul&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise: Factory Method Pattern (Mar 29)</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_march29_Factory_Method_Pattern.html" rel="alternate"/><published>2024-09-19T00:00:00+05:00</published><updated>2024-09-19T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-19:/lums-cs360/archive/class_participation_exer_march29_Factory_Method_Pattern.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise: Factory Method Pattern&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Design a framework using the Factory Method Pattern for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Application and Document superclasses &lt;/li&gt;
&lt;li&gt;And an actual application would make these:&lt;ul&gt;
&lt;li&gt;Add MyApplication and MyDocument subclasses&lt;/li&gt;
&lt;li&gt;Add YourApplication and YourDocument subclasses&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Write a general newDocument method in Application that ultimately instantiates a MyDocument if your application is a MyApplication.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Draw the UML class diagram for the above problem using the Factory Method Pattern using concrete and abstract classes.&lt;/li&gt;
&lt;li&gt;What is the code in MyApplication for the method newDocument?&lt;/li&gt;
&lt;/ul&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise: Template Method Pattern (Mar 26)</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_march26_Template_Method.html" rel="alternate"/><published>2024-09-19T00:00:00+05:00</published><updated>2024-09-19T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-19:/lums-cs360/archive/class_participation_exer_march26_Template_Method.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise: Template Method Pattern&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Rewrite &lt;code&gt;countWords()&lt;/code&gt;
* Convert the &lt;code&gt;countWords()&lt;/code&gt; method to a template method using the &lt;strong&gt;Template Method Pattern&lt;/strong&gt;, removing the conditionals.&lt;/p&gt;
&lt;p&gt;Write code for one of the following subclasses:
* &lt;code&gt;RawWordCounter&lt;/code&gt;
* &lt;code&gt;WordCounterNoStopWords&lt;/code&gt;
* &lt;code&gt;LowerCaseWordCounter&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;WordCounter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;countWords&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;loadData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lowerCaseWords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;lowerCaseData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;removeStopWords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;filterStopWords&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;calculateTermFrequency&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;calculateTermDocumentFrequency&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;saveCountData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 11</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer11.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_exer11.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 11&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Apply the composite design pattern to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;model the structural representation of binary logical expressions involving the binary operators and and or, and boolean literals true and false; and&lt;/li&gt;
&lt;li&gt;support the uniform, recursive evaluation of such expressions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Draw the UML class diagram for the object-oriented design, applying the design pattern. Include suitable classes, relationships, attributes, and methods.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 12</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer12.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_exer12.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 12&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation. An answer will be discussed in class.&lt;/p&gt;
&lt;p&gt;You have a design where a two-dimensional rectangle drawing method takes a top left point and a bottom right point. Also, in your design, the points are specified by integer x and y coordinates.&lt;/p&gt;
&lt;p&gt;public interface RectangleDrawer {
    public void draw( Point topLeft, Point bottomRight );
}
Suppose, however, you want to reuse a rectangle drawing method that takes four integer parameters: top left x coordinate, top left y coordinate, width, and height.&lt;/p&gt;
&lt;p&gt;public class RectangleRenderer {
    public void render( int x, int y, int width, int height ) { ... }
    ...
}
Write Java code for a rectangle drawing object adapter.&lt;/p&gt;
&lt;p&gt;public class RectangleDrawerAdapter ...
Submit your Java code as a zip archive.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 13</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer13.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_exer13.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 13&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation. An answer will be discussed in class.&lt;/p&gt;
&lt;p&gt;Apply the decorator design pattern to represent the structure of a pizza and for calculating its total cost.&lt;/p&gt;
&lt;p&gt;Starting with a base (e.g., thick crust), you can decorate with successive toppings (e.g., rich sauce, then pepperoni, then cheese). Each base or topping has a specific incremental cost to add to the total cost.&lt;/p&gt;
&lt;p&gt;Draw a UML class diagram that applies the decorator pattern for the structure of the above base and toppings.&lt;/p&gt;
&lt;p&gt;Submit your diagram as a PNG file.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 9</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer9.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_exer9.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 9&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Consider a Rect class to represent a rectangle in a two-dimensional integer plane.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Rect&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// create rectangle with given corners&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Rect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Point&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;topLeft&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Point&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;botRight&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;// return true iff point p is in or on this rectangle&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;encloses&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Point&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Depict a thorough set of test case equivalence classes for the encloses method, also indicating the expected results. Add explanatory text as needed for analogous or unusual cases. State any assumptions.&lt;/p&gt;
&lt;p&gt;Do not implement the method. Do not write test code. Do not use JUnit.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 9</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_code_to_uml_jan_15.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_code_to_uml_jan_15.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;strong&gt;Class Participation Exercise: Code to UML (UFO)&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;// UFO.java&lt;/span&gt;
&lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;UFO&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Collection&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Earthling&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;abductees&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Earthling.java&lt;/span&gt;
&lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Earthling&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;stomachs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;boolean&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mindProbeable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;img alt="" src="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_code_to_uml_jan_15_1.png"&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;What notation goes here for this relationship?&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;a) Not selected
b) ←
c) —
d) ◇
e) ◆
f) ◁
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;What notation goes here for the multiplicity&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;a) 0
b) 1
c) 0..1
d) 0.._
e) 1.._
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;What notation goes here for the instance variable?&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;a) private
b) public
c) -
d) +
e) attributes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;What notation goes here for this method?&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;a) private
b) public
c) -
d) +
e) behaviors
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;img alt="" src="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_code_to_uml_jan_15_2.png"&gt;&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise April 14</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_april14.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_exer_april14.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;p&gt;Speaker is a class that utters words and uses the &lt;strong&gt;state&lt;/strong&gt; pattern to change its behaviour.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Speaker&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;Speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="c1"&gt;// delegate behaviour&lt;/span&gt;

&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;Speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Squawk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;implements&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Cluck&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;implements&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Tick&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;implements&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Tick”;&lt;/span&gt;

&lt;span class="s"&gt;     }&lt;/span&gt;

&lt;span class="s"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Speaker has behaviours such as Squawk which returns random Squawking strings, and Cluck which returns random clucking strings. Tick just returns "Tick”.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Finish&lt;/strong&gt; this decorator for Speak states that lowercases the Speak states.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;//&amp;quot;X”.toLowerCase().equals(&amp;quot;x”)&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LowerCaseSpeakDecorator&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;implements&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;Speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;LowerCaseSpeakDecorator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;delegate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="n"&gt;speak&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;delegate&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;







&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Show how to make a lowercase tick behaviour.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise April 17</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_april7.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_exer_april7.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="../general/slides/adapter-pattern-quiz.pdf"&gt;View adapter-pattern-quiz&lt;/a&gt;&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise (Code to UML)</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_codeToUML.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_exer_codeToUML.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Consider a Rect class to represent a rectangle in a two-dimensional integer plane.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Shape&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;protected&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;myLocation&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Shape&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setLocation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getLocation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Square&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;extends&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Shape&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Square&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setSide&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Document this Java code by expressing its design in a corresponding UML class diagram.&lt;/p&gt;
&lt;p&gt;Submit the diagram as a PNG or JPG or PDF file.&lt;/p&gt;
&lt;p&gt;(For this exercise, the diagram can be hand drawn on paper, with a picture of it submitted as the file.)&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise Design Principles</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_designPrinciples.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/class_participation_exer_designPrinciples.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;p&gt;Proper completion of this exercise is considered as part of course participation.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Initial versions of early programming languages (e.g., Fortran) supported:&lt;/li&gt;
&lt;li&gt;[ ] abstract data types&lt;/li&gt;
&lt;li&gt;[ ] program and subroutines&lt;/li&gt;
&lt;li&gt;[ ] local variables&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;[ ] classes and objects&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Abstraction is the idea of simplifying a concept in the problem domain to its essentials within some &lt;strong&gt;&lt;em&gt;_&lt;/em&gt;&lt;/strong&gt;___.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Using encapsulation is sometimes called &lt;strong&gt;&lt;em&gt;_&lt;/em&gt;&lt;/strong&gt;___ thinking.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Decomposition of a whole thing into parts mainly involves thinking about:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;[ ] fixed or dynamic number of parts&lt;/li&gt;
&lt;li&gt;[ ] essential attributes and behaviors of parts&lt;/li&gt;
&lt;li&gt;[ ] lifetimes of wholes and parts&lt;/li&gt;
&lt;li&gt;[ ] commonalities among the parts&lt;/li&gt;
&lt;/ol&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise Proxy Pattern</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/Class_Participation_Exercise_Proxy_Pattern.html" rel="alternate"/><published>2024-09-18T00:00:00+05:00</published><updated>2024-09-18T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-18:/lums-cs360/archive/Class_Participation_Exercise_Proxy_Pattern.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise: Proxy Pattern&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Use the Proxy pattern to improve performance by not reading files that aren't actually needed yet.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;OurFile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;fileContents&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// returns entire file&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ConcreteFile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;implements&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;OurFile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fileContents&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ConcreteFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;fileContents&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;fileContents&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;assume &lt;code&gt;ConcreteFile&lt;/code&gt; exists and implements &lt;code&gt;OurFile&lt;/code&gt;. &lt;code&gt;ConcreteFile&lt;/code&gt; reads the entire file when it is constructed.&lt;/p&gt;
&lt;p&gt;Write java code for &lt;code&gt;ProxyFile&lt;/code&gt; that proxies a &lt;code&gt;ConcreteFile&lt;/code&gt; and doesn't have to read the entire file until  the contents of the file are needed, using the proxy pattern.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 2020-04-06 Long Method Refactoring</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_20200406_Long_Method_Refactoring.html" rel="alternate"/><published>2024-09-17T00:00:00+05:00</published><updated>2024-09-17T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-17:/lums-cs360/archive/class_participation_exer_20200406_Long_Method_Refactoring.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise: Long Method Refactoring&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Extracts methods from this long method body by putting a box around code that will go into a new method. Then on the right hand side of that box write the method name.&lt;/p&gt;
&lt;p&gt;At the bottom, rewrite insertRecipe using those new methods.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="cm"&gt;/**&lt;/span&gt;

&lt;span class="cm"&gt;* Inserts a Recipe into the Webservice&lt;/span&gt;

&lt;span class="cm"&gt;*/&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;insertRecipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Recipe&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;StringEntity&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;stringentity&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="n"&gt;stringentity&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;StringEntity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gson&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toJson&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;UnsupportedEncodingException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="n"&gt;handleError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;HttpPost&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;httpPost&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;HttpPost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;recipeURI&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;httpPost&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Accept&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;application/json&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;httpPost&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;setEntity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stringentity&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;HttpResponse&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;httpclient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;httpPost&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ClientProtocolException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="n"&gt;handleError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IOException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="n"&gt;handleError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="n"&gt;HttpEntity&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getEntity&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="n"&gt;EntityUtils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;consume&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IOException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="n"&gt;handleError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;httpPost&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;releaseConnection&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;insertRecipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Recipe&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;recipe&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// your new refactored method&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 2020-04-08 Refactoring</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_20200408_Refactoring.html" rel="alternate"/><published>2024-09-17T00:00:00+05:00</published><updated>2024-09-17T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-17:/lums-cs360/archive/class_participation_exer_20200408_Refactoring.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;License&lt;/strong&gt;  &lt;/p&gt;
&lt;p&gt;Copyright 2012 Neil Borle, Mitchell Home, Bronte Lee, Aaron Padlesky, Eddie Santos   &lt;br&gt;
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License.  &lt;br&gt;
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0  &lt;/p&gt;
&lt;p&gt;Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br&gt;
See the License for the specific language governing permissions and limitations under the License. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise: Refactoring&lt;/strong&gt;&lt;/p&gt;
&lt;div style="text-align: center; margin: 20px;"&gt;
    &lt;img src="https://lums-cs360-web.github.io/lums-cs360/archive/exer20200408refactoring.png" alt="Participation Exercise Image" style="width: 800px;"&gt;
&lt;/div&gt;

&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ResponseObtainerObtainer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;static&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ResponseObtainer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getResponseObtainer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;MediaType&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;LayoutInflater&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;inflater&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="n"&gt;ViewGroup&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;throws&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;ResponseObtainer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;obtainer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;layout_id&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;ViewGroup&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;Class&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;extends&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ResponseObtainer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;obtainerClass&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;media&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;layout_id&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;R&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;layout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fragment_fulfill_text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;obtainerClass&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;TextResponseObtainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;AUDIO&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;layout_id&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;R&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;layout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fragment_fulfill_audio&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;obtainerClass&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;AudioResponseObtainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PHOTO&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;layout_id&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;R&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;layout&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fragment_fulfill_photo&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="n"&gt;obtainerClass&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;PhotoResponseObtainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="c1"&gt;// err....&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="c1"&gt;// TODO: Give an error response obtainer?&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ViewGroup&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;inflater&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;inflate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;layout_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;obtainer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;obtainerClass&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getConstructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ViewGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;                    &lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newInstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;obtainer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;List 1: Code Smell&lt;/p&gt;
&lt;p&gt;Evident in this code:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Propose or draw a refactoring for this code.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Why would a MediaType (TEXT, AUDIO, PHOTO) still be necessary after a refactoring?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 3</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer3.html" rel="alternate"/><published>2024-09-17T00:00:00+05:00</published><updated>2024-09-17T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-17:/lums-cs360/archive/class_participation_exer3.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 3&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation. An answer will be discussed in class.&lt;/p&gt;
&lt;p&gt;Convert this UML class diagram to corresponding basic Java source code.&lt;/p&gt;
&lt;p&gt;&lt;img alt="UML Class Diagram" src="https://lums-cs360-web.github.io/lums-cs360/archive/part3img1.png" style="margin: 20px auto;" width="600"&gt;&lt;/p&gt;
&lt;p&gt;Submit your code as a zip archive of the Java files. Or hand write the code on paper, and submit a picture of it as a PNG or JPG or PDF file.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 8</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer8.html" rel="alternate"/><published>2024-09-17T00:00:00+05:00</published><updated>2024-09-17T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-17:/lums-cs360/archive/class_participation_exer8.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 8&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation. An answer will be discussed in class.&lt;/p&gt;
&lt;p&gt;Model the following behavior using a correct UML state diagram.&lt;/p&gt;
&lt;p&gt;I want to keep my flamethrower in a vault that's hard to find.&lt;/p&gt;
&lt;p&gt;So, to reveal the lock to the vault, I have to remove a helmet from a shelf. This will reveal the lock only while a door is closed.&lt;/p&gt;
&lt;p&gt;Once I can see the lock, I can insert my key to open the vault.&lt;/p&gt;
&lt;p&gt;For extra security, I make sure that I can open the vault only if I put the helmet back on the shelf.&lt;/p&gt;
&lt;p&gt;If an intruder forgets this precaution, a facehugger will be unleashed to disable the intruder.&lt;/p&gt;
&lt;p&gt;Submit the diagram as a PNG file.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="reading"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 15</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer15.html" rel="alternate"/><published>2024-09-12T00:00:00+05:00</published><updated>2024-09-12T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-12:/lums-cs360/archive/class_participation_exer15.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 15&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation. An answer will be discussed in class.&lt;/p&gt;
&lt;p&gt;Consider the following (partial) implementation of a Person class.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getTelephoneNumber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;(&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;officeAreaCode&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;quot;) &amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;officeNumber&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getOfficeAreaCode&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;officeAreaCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setOfficeAreaCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;areaCode&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;officeAreaCode&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;areaCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;getOfficeNumber&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;officeNumber&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;setOfficeNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="n"&gt;officeNumber&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;officeAreaCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="kd"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;officeNumber&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Draw the UML class diagram for the refactored design.&lt;/p&gt;
&lt;p&gt;Submit your diagram as a PNG file.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 20</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer20.html" rel="alternate"/><published>2024-09-10T00:00:00+05:00</published><updated>2024-09-10T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-10:/lums-cs360/archive/class_participation_exer20.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise 20&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Consider the following method to compute the base-two logarithm of a byte value (assumed positive here, maximum 127), truncated down to the nearest integer. For example, if the byte value is 17, the method returns 4.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;static&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;logb2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Assume this method is heavily used, and that operations like Math.log( double ) are relatively slow and should be avoided.&lt;/p&gt;
&lt;p&gt;Optimize this method to reduce the computation time needed, while maintaining the same expected behavior and using comparable data space. Your method must be proper Java and be a self-contained implementation (not call other methods). Add comments as appropriate to explain how it is intended to work.&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise 19</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer19.html" rel="alternate"/><published>2024-09-03T00:00:00+05:00</published><updated>2024-09-03T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-09-03:/lums-cs360/archive/class_participation_exer19.html</id><summary type="html">&lt;p&gt;Class Participation Exercise 19&lt;/p&gt;</summary><content type="html">&lt;div class="toc"&gt;
&lt;ul&gt;&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Opened:&lt;/strong&gt; Monday, 5 August 2019, 10:29 AM&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Closed:&lt;/strong&gt; Tuesday, 6 August 2019, 4:59 PM&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Proper completion of this exercise is considered as part of course participation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Consider the following sloppily designed user interface (a form for a web browser). Identify at least 5 issues why this user interface design is poor or inconsistent.&lt;/p&gt;
&lt;p&gt;&lt;img alt="User Interface" src="https://lums-cs360-web.github.io/lums-cs360/archive/part19img1.png" style="margin: 20px;" width="300"&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue 1:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 2:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 3:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 4:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 5:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 6:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 7:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 8:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 9:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;strong&gt;Issue 10:&lt;/strong&gt;&lt;/p&gt;
&lt;textarea rows="2" cols="100" placeholder="Enter your text here..."&gt;&lt;/textarea&gt;

&lt;p&gt;&lt;button onclick="alert('Button clicked!')"&gt;Save as new template&lt;/button&gt;&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="exercise"/><category term="archive"/></entry><entry><title>Project Problem Description</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/project_problem_descr_W2024.html" rel="alternate"/><published>2024-08-26T00:00:00+05:00</published><updated>2024-08-26T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-08-26:/lums-cs360/archive/project_problem_descr_W2024.html</id><summary type="html">&lt;p&gt;Project Problem Description&lt;/p&gt;</summary><content type="html">&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#project-problem-description"&gt;Project Problem Description&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#event-lottery-system-application"&gt;Event Lottery System Application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#description"&gt;Description:&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#features"&gt;Features:&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h3 id="project-problem-description"&gt;Project Problem Description&lt;/h3&gt;
&lt;p&gt;Warning: This is subject to change!&lt;/p&gt;
&lt;h4 id="event-lottery-system-application"&gt;&lt;strong&gt;Event Lottery System Application&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;You are to design and implement a simple, attractive, and easy-to-use Android application to satisfy the following goals. Your design must be flexible enough to allow developers to extend or migrate it.&lt;/p&gt;
&lt;h4 id="description"&gt;&lt;strong&gt;Description:&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;We want a mobile application where people can sign up for events at community centres that are popular and fill up fast. We want to allow people with limitations such as work, disability, etc. to be able to sign up for these events fairly and not have to sit refreshing a webpage until they can get a chance at reserving a spot.&lt;/p&gt;
&lt;p&gt;How? Lottery! If I am running swimming lessons for 20 kids, I will post my event or series of events and I will let everyone join the waiting list for a period of a week. After the week is up, I will ask the system to choose 20 kids to sign up. The system will then notify these kids (or their guardians), if they say no they don’t want swimming lessons, then the system will sample another child to sign up. I can monitor the progress and then get access to the final list of everyone who signs up. If perhaps someone cancels later I can cancel them in the app and a new applicant is drawn.&lt;/p&gt;
&lt;p&gt;Lottery systems are great because you don’t have to first get a chance to go to an event, you just have to say you are interested and if you’re lucky you will be offered a chance. This gives people who need the time, the time to sign up properly without a time pressure. Accessibility!&lt;/p&gt;
&lt;h4 id="features"&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Pooling System:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Organizers can draw from a waiting list of interested event attendees as selected participants.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;QR Code Scanning:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;entrants can scan QR promotional code to view details about the event and also join the waiting list&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Firebase Integration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Utilize Firebase for storing event details, attendee lists, and real-time check-in status updates.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Multi-User Interaction:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Distinguish between entrants, organizers, and admin with special roles and privileges granted to each actor.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Image Upload:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Allow event organizers upload event poster image&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Geolocation Verification (Optional)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Optionally use geolocation to verify where users are joining the waiting list from. This is the location provided by the device.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I want to sign my partner up to swim lessons, they need to learn how to swim if they are going to go canoeing with me. I go to the local rec centre, I see they have listed swimming lessons for beginners, I scan the QR code. I see that it is open to register for 2 more days. I click register. 2 days later when it is closed the system samples people, but not me. It notifies me that I wasn’t sampled in the first draw, but there might be a chance if someone declines. Nobody declines. Boo.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I am running an interpretive dance class where I teach the safety basics of dance (no eye gouging, that kind of stuff). I tell the app that I have classes every monday From 2025-01-01 to 2025-03-01, and that you need to register by 2024-12-15 and registration opens on 2024-12-01. The price is $60 and I can accommodate 60 people. I click publish and now an event is made where people can join the waiting list and they get this basic information. Also a QR code is generated that will lead them to this page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I want to sign my partner up to piano lessons, they need to learn how to play if they are going to play piano with me. I go to the app, I go to my local rec centre, I see they have listed piano lessons for beginners, I scan the QR code. I see that it is open to register for 2 more days. I click register. 2 days later when it is closed the system samples people, but not me. It notifies me that I was sample.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Actors:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Entrant: a person who signs up for an event&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Organizer: the entity that runs the event&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Administrator: The entity that administers and runs the infrastructure&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Glossary:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;QR Code: a scannable code, either a barcode, a QR code, or other code scannable by Zebra crossing libraries or google QR code scanning libraries.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Entrant: someone who declares their interest in signing up for an event by joining the waiting list&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Waiting List: a record of entrants that showed interest in a specific event&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Sign Up : An action of registering/confirming for an event when successfully selected&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can think of this like accepting an invitation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Profile : A screen on the application that holds information about an entrant&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choosing: Randomly selecting a number of entrants in the waiting list to be invited to sign up&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;User Stories:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;User needs are expressed in the form of partial user stories:&lt;/p&gt;
&lt;p&gt;As a (role), I want (goal).&lt;/p&gt;
&lt;p&gt;These descriptions may change to correct omissions and clarify noticed issues. New requirements will be introduced for the final project part.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;User:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;US 01.01.01 As an entrant, I want to join the waiting list for a specific event&lt;/p&gt;
&lt;p&gt;US 01.01.02 As an entrant, I want to leave the waiting list for a specific event &lt;/p&gt;
&lt;p&gt;US 01.02.01 As an entrant, I want to provide my personal information such as name, email and optional phone number in the app&lt;/p&gt;
&lt;p&gt;US 01.02.02 As an entrant I want to update information such as name, email and contact information on my profile&lt;/p&gt;
&lt;p&gt;US 01.03.01 As an entrant I want to upload a profile picture for a more personalized experience&lt;/p&gt;
&lt;p&gt;US 01.03.02 As an entrant I want remove profile picture if need be&lt;/p&gt;
&lt;p&gt;US 01.03.03 As an entrant I want my profile picture to be deterministically generated from my profile name if I haven't uploaded a profile image yet.&lt;/p&gt;
&lt;p&gt;US 01.04.01 As an entrant I want to receive notification when chosen from the waiting list (when I "win" the lottery)&lt;/p&gt;
&lt;p&gt;US 01.04.02 As an entrant I want to receive notification of not chosen on the app (when I "lose" the lottery)&lt;/p&gt;
&lt;p&gt;US 01.04.03 As an entrant I want to opt out of receiving notifications from organizers and admin&lt;/p&gt;
&lt;p&gt;US 01.05.01 As an entrant I want another chance to be chosen from the waiting list if a selected user declines an invitation to sign up&lt;/p&gt;
&lt;p&gt;US 01.05.02 As an entrant I want to be able to accept the invitation to register/sign up when chosen to participate in an event&lt;/p&gt;
&lt;p&gt;US 01.05.03 As an entrant I want to be able to decline an invitation when chosen to participate in an event&lt;/p&gt;
&lt;p&gt;US 01.06.01 As an entrant I want to view event details within the app by scanning the promotional QR code&lt;/p&gt;
&lt;p&gt;US 01.06.02 As an entrant I want to be able to be sign up for an event by scanning the QR code&lt;/p&gt;
&lt;p&gt;US 01.07.01 As an entrant, I want to be identified by my device, so that I don't have to use a username and password&lt;/p&gt;
&lt;p&gt;US 01.08.01 As an entrant, I want to be warned before joining a waiting list that requires geolocation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Organizer:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;US 02.01.01 As an organizer I want to create a new event and generate a unique promotional QR code that links to the event description and event poster in the app&lt;/p&gt;
&lt;p&gt;US 02.01.02 As an organizer I want to store the generated QR code in my database&lt;/p&gt;
&lt;p&gt;US 02.01.03 As an organizer, I want to create and manage my facility profile.&lt;/p&gt;
&lt;p&gt;US 02.02.01 As an organizer I want to view the list of entrants who joined my event waiting list&lt;/p&gt;
&lt;p&gt;US 02.02.02 As an organizer I want to see on a map where entrants joined my event waiting list from.&lt;/p&gt;
&lt;p&gt;US 02.02.03 As an organizer I want to enable or disable the geolocation requirement for my event.&lt;/p&gt;
&lt;p&gt;US 02.03.01 As an organizer I want to OPTIONALLY limit the number of entrants who can join my waiting list&lt;/p&gt;
&lt;p&gt;US 02.04.01 As an organizer I want to upload an event poster to provide visual information to entrants &lt;/p&gt;
&lt;p&gt;US 02.04.02 As an organizer I want to update an event poster to provide visual information to entrants &lt;/p&gt;
&lt;p&gt;US 02.05.01 As an organizer I want to send a notification to chosen entrants to sign up for events.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This is the notification that they "won" the lottery.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;US 02.05.02 As an organizer I want to set the system to sample a specified number of attendees to register for the event&lt;/p&gt;
&lt;p&gt;US 02.05.03 As an organizer I want to be able to draw a replacement applicant from the pooling system when a previously selected applicant cancels or rejects the invitation&lt;/p&gt;
&lt;p&gt;US 02.06.01 As an organizer I want to view a list of all chosen entrants who are invited to apply&lt;/p&gt;
&lt;p&gt;US 02.06.02 As an organizer I want to see a list of all the cancelled entrants&lt;/p&gt;
&lt;p&gt;US 02.06.03 As an organizer I want to see a final list of entrants who enrolled for the event&lt;/p&gt;
&lt;p&gt;US 02.06.04 As an organizer I want to cancel entrants that did not sign up for the event &lt;/p&gt;
&lt;p&gt;US 02.07.01 As an organizer I want to send notifications to all entrants on the waiting list&lt;/p&gt;
&lt;p&gt;US 02.07.02 As an organizer I want to send notifications to all selected entrants&lt;/p&gt;
&lt;p&gt;US 02.07.03 As an organizer I want to send a notification to all cancelled entrants&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Admin:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;US 03.01.01 As an administrator, I want to be able to remove events.&lt;/p&gt;
&lt;p&gt;US 03.02.01 As an administrator, I want to be able to remove profiles.&lt;/p&gt;
&lt;p&gt;US 03.03.01 As an administrator, I want to be able to remove images.&lt;/p&gt;
&lt;p&gt;US 03.03.02 As an administrator, I want to be able to remove hashed QR code data&lt;/p&gt;
&lt;p&gt;US 03.04.01 As an administrator, I want to be able to browse events.&lt;/p&gt;
&lt;p&gt;US 03.05.01 As an administrator, I want to be able to browse profiles.&lt;/p&gt;
&lt;p&gt;US 03.06.01 As an administrator, I want to be able to browse images.&lt;/p&gt;
&lt;p&gt;US 03.07.01 As an administrator I want to remove facilities that violate app policy&lt;/p&gt;</content><category term="archive"/><category term="projects"/><category term="teams"/><category term="grading"/></entry><entry><title>Assignment 1</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/assigment1-F2024.html" rel="alternate"/><published>2024-08-12T00:00:00+05:00</published><updated>2024-08-12T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2024-08-12:/lums-cs360/archive/assigment1-F2024.html</id><summary type="html">&lt;p&gt;Assignment 1&lt;/p&gt;</summary><content type="html">&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#learning-objectives"&gt;Learning Objectives&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#problem-description"&gt;Problem Description&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#deliverables"&gt;Deliverables&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#demonstration-actions"&gt;Demonstration Actions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#hints"&gt;Hints&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#losing-marks"&gt;Losing Marks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#submission-procedure"&gt;Submission Procedure&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Due date:&lt;/strong&gt; Check the &lt;a href="https://lums-cs360-web.github.io/lums-cs360/#schedule"&gt;schedule&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="learning-objectives"&gt;&lt;strong&gt;Learning Objectives&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Solve a problem by constructing a simple, interactive application using Android and Java.&lt;/p&gt;
&lt;p&gt;Document an object-oriented design in Unified Modeling Language.&lt;/p&gt;
&lt;h3 id="problem-description"&gt;&lt;strong&gt;Problem Description&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Consider the situation of someone who wants to create and manage a wishlist of books they want to read. Develop a simple, attractive, and intuitive Android mobile app to assist users in organizing their reading preferences. Let's name this app: YOURCCID-MyBookWishlist (e.g., kennyw-MyBookWishlist).&lt;/p&gt;
&lt;p&gt;Using this app, users can maintain a list of books they wish to read. Each book entry in the wishlist has the following editable fields:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Book title (textual, up to 50 characters)&lt;/li&gt;
&lt;li&gt;Author name (textual, up to 30 characters)&lt;/li&gt;
&lt;li&gt;Genre (e.g., Fiction, Non-Fiction, Mystery)&lt;/li&gt;
&lt;li&gt;Publication year (four-digit integer)&lt;/li&gt;
&lt;li&gt;Status (Read/Unread)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The app must allow the user to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Show a list of books in their wishlist, displaying the title, author, genre, and read status.&lt;/li&gt;
&lt;li&gt;Add a new book to the wishlist (appends to the bottom of the list).&lt;/li&gt;
&lt;li&gt;View and edit the details of an existing book entry, including title, author, genre, and read status.&lt;/li&gt;
&lt;li&gt;Delete a book from the wishlist.&lt;/li&gt;
&lt;li&gt;See the total number of books in the wishlist and the count of books marked as read.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The list need not display all the information for an item if screen space is limited. Minimally, each item in the list should show its title, author, genre, and read status.&lt;/p&gt;
&lt;p&gt;The app must assist the user in proper data entry. For example, use appropriate user interface controls to enforce particular data types and avoid illegal values.&lt;/p&gt;
&lt;p&gt;For this assignment, the data need not be persistent across runs of the app.&lt;/p&gt;
&lt;p&gt;The app must assist the user in proper data entry. For example, use appropriate user interface controls to enforce particular data types and avoid illegal values.&lt;/p&gt;
&lt;p&gt;For this assignment, the data need not be persistent across runs of the app.&lt;/p&gt;
&lt;p&gt;Encode your campus computing ID in the app name. Specifically, the app name must show up as YOURCCID-MyBookWishlist (e.g., kennyw-MyBookWishlist).&lt;/p&gt;
&lt;h3 id="deliverables"&gt;&lt;strong&gt;Deliverables&lt;/strong&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Code Base:&lt;/strong&gt;
Your complete source code and compiled binary, implementing the working app and its user interface, will be inspected and run by the TA. The Android Studio project and APK (Android Package Kit) binary must be included in the submission. Each class must contain comments describing its purpose, design rationale, and any outstanding issues.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Video:&lt;/strong&gt;
The video is a demonstration of the app. The video file must be included in the submission. The video is meant to show that the demonstration actions below actually work. No audio is needed. Maximum duration is 3 minutes. Focus on just the screen of the app, not the whole desktop. For visual clarity, do not use a handheld camera.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;System Documentation:&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Describe the structure of your app's object-oriented design using UML class diagram(s), saved as non-lossy image file(s).` Focus on the most important classes that you designed and implemented. Add notes to describe the main responsibilities of these classes.&lt;/p&gt;
&lt;p&gt;You do not need to include classes from android or java standard library in your UML.&lt;/p&gt;
&lt;h3 id="demonstration-actions"&gt;&lt;strong&gt;Demonstration Actions&lt;/strong&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Open the app from the launcher.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Show the list of books in the wishlist, with none so far. (This could be the initial screen.)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a book to the wishlist with the title "The Great Gatsby," author "F. Scott Fitzgerald," genre "Fiction," publication year 1925, and status "Unread."&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Show the list and the total count, with this item.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;View/edit this item to update the title to "The Great Gatsby: Updated Edition" and mark it as "Read."&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Show the list and the updated counts, with this modified item.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add another book to the wishlist with the title "To Kill a Mockingbird," author "Harper Lee," genre "Fiction," publication year 1960, and status "Unread."&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Show the list and the updated counts, with the two books.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add one more book to the wishlist with your CCID as the author and your student number as the title of the book, status "Read", year 2024.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Show the list and the updated counts, with the three books.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;View/edit the details of one book in the wishlist.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Delete one book from the wishlist.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Show the list, with the remaining books.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;View the details of one book in the wishlist.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Delete the remaining books from the wishlist.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="hints"&gt;&lt;strong&gt;Hints&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;This is a description of the core functionality. Often, problem statements from users lack details. As you are prototyping a design, you may uncover other behaviors that have not been specified, but make sense in the context and intent of the application. For example, think about how someone might effectively use your application. It is up to you to decide what functions your design will need, based on the given problem description and valid assumptions, in discussion with your users (the TAs and instructor). You should consider asking the customer (the instructor) what they want to see.&lt;/p&gt;
&lt;p&gt;While you may discuss your design with other students, the code and documentation must be your own work. Code from publicly available sources may be used within reason and only if their licenses permit so. Always fully cite to give proper credit to the original developers in the source code and in the system documentation. For example, in citing a work, at least state: from whom, the date of publication, license, and URL. Do what is required by its license.&lt;/p&gt;
&lt;p&gt;The TAs will be inspecting your code, so "major" commented-out experiments should be cleaned up so that the code is readable.&lt;/p&gt;
&lt;p&gt;Do not skimp on the UML class diagrams in the system documentation. For neatness and readability, diagrams should be created or drawn using a vector graphics editing tool and exported in a common, non-lossy graphics format.&lt;/p&gt;
&lt;p&gt;Besides addressing the problem correctly, your software design will be evaluated on its proper use of object-oriented design concepts, such as separation of concerns and information hiding.&lt;/p&gt;
&lt;h3 id="losing-marks"&gt;&lt;strong&gt;Losing Marks&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;You may lose marks for any of the following:&lt;/p&gt;
&lt;p&gt;files not in properly named subdirectories
missing compiled binary APK file for the app
cannot run the app after install
cannot distinguish CCID from the app name
cannot view files without specialized tools
lossy compression used in image file(s) for UML (e.g., JPEG)
inadequate or improper citations
These are brown M&amp;amp;M rules.&lt;/p&gt;
&lt;h3 id="submission-procedure"&gt;&lt;strong&gt;Submission Procedure&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Create an assignment directory called ROLLNUM-MyBookWishlist (e.g., 25100052-MyBookWishlist), and within it have three subdirectories: code,  video,  doc. &lt;/p&gt;
&lt;p&gt;Your Android Studio project directory goes within code. The compiled binary APK file(s) should be found within an /app/build/intermediates/apk/debug/app-debug.apk subdirectory or /app/build/outputs/apk/debug/app-debug.apk within the project directory. The video file goes in the video subdirectory. The UML documentation goes in the doc subdirectory.&lt;/p&gt;
&lt;p&gt;Zip the assignment directory and upload to eClass. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;e: It must be a zip file with the .zip file extension.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Please make sure all the required files are included to build the app. The TA will test your app from the submitted code and APK file.&lt;/p&gt;
&lt;p&gt;The app name must show up as ROLLNUM-MyBookWishlist (e.g., 25100052-MyBookWishlist), so that it can be easily distinguished from other submissions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;This is how the assignment will be marked:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;There are no inbetween marks, no part marks.&lt;/p&gt;
&lt;p&gt;Rubric for Android App Assignment - MyBookWishlist&lt;/p&gt;
&lt;p&gt;Excellent (8):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The app is fully functional, meeting all the specified requirements.&lt;/li&gt;
&lt;li&gt;The user interface is intuitive, attractive, and responsive.&lt;/li&gt;
&lt;li&gt;The app follows the brown M&amp;amp;M rules.&lt;/li&gt;
&lt;li&gt;The UML documentation is comprehensive and accurately represents the object-oriented design.&lt;/li&gt;
&lt;li&gt;The video demonstration clearly showcases all required actions, and the app performs flawlessly in the demo.&lt;/li&gt;
&lt;li&gt;Must have a Video&lt;/li&gt;
&lt;li&gt;Must have UML&lt;/li&gt;
&lt;li&gt;Must Have Codebase&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Good (7):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The app runs and performs the expected functionalities.&lt;/li&gt;
&lt;li&gt;Minor issues may be present, such as a small bug or a slight deviation from the requirements.&lt;/li&gt;
&lt;li&gt;The user interface is satisfactory but may have some room for improvement.&lt;/li&gt;
&lt;li&gt;The app follows the brown M&amp;amp;M rules.&lt;/li&gt;
&lt;li&gt;The UML documentation is mostly complete but may have minor omissions.&lt;/li&gt;
&lt;li&gt;Must have a Video&lt;/li&gt;
&lt;li&gt;Must have UML&lt;/li&gt;
&lt;li&gt;Must Have Codebase&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Satisfactory (5):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The app runs, but there are noticeable issues affecting its stability or functionality.&lt;/li&gt;
&lt;li&gt;Some requirements may be missing or not fully implemented.&lt;/li&gt;
&lt;li&gt;The user interface is functional but may lack polish or suffer from usability issues.&lt;/li&gt;
&lt;li&gt;The app may not fully adhere to the brown M&amp;amp;M rules.&lt;/li&gt;
&lt;li&gt;The UML documentation is present but may be incomplete or inaccurate.&lt;/li&gt;
&lt;li&gt;Must have a Video&lt;/li&gt;
&lt;li&gt;Must have UML&lt;/li&gt;
&lt;li&gt;Must Have Codebase&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Unsatisfactory (4):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Effort has been put into the assignment, but the app may not run well or may have significant functionality issues.&lt;/li&gt;
&lt;li&gt;Several requirements are missing or not implemented.&lt;/li&gt;
&lt;li&gt;The user interface may be confusing or challenging to use.&lt;/li&gt;
&lt;li&gt;The app may not follow the brown M&amp;amp;M rules.&lt;/li&gt;
&lt;li&gt;The UML documentation lacks essential components, incomplete, inaccuate.&lt;/li&gt;
&lt;li&gt;Must have a Video&lt;/li&gt;
&lt;li&gt;Must have UML&lt;/li&gt;
&lt;li&gt;Must Have Codebase&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Failure (0):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The assignment is incomplete, lacking essential components such as UML documentation, video demonstration, or code.&lt;/li&gt;
&lt;li&gt;No submission is provided.&lt;/li&gt;
&lt;li&gt;Could be missing any one of these: Video, UML, Codebase&lt;/li&gt;
&lt;/ul&gt;</content><category term="archive"/><category term="individual"/><category term="policy"/><category term="grading"/></entry><entry><title>Class Participation Exercise Simple Factory</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_exer_20200327_SimpleFactory.html" rel="alternate"/><published>2020-03-27T00:00:00+05:00</published><updated>2020-03-27T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2020-03-27:/lums-cs360/archive/class_participation_exer_20200327_SimpleFactory.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Class Participation Exercise&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Write a Simple Factory that opens a String URI that can either be to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a file (starts with file:///),&lt;/li&gt;
&lt;li&gt;a webpage (starts with http://),&lt;/li&gt;
&lt;li&gt;or a TLS/SSL encrypted webpage (starts with https://).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You have the &lt;strong&gt;File&lt;/strong&gt; class, the &lt;strong&gt;HTTPFile&lt;/strong&gt; class and the HTTPSFile class that all accept a &lt;strong&gt;string&lt;/strong&gt; in their constructor giving the &lt;strong&gt;URI&lt;/strong&gt; (Uniform Resource Identifier). &lt;strong&gt;HTTPFile&lt;/strong&gt; and &lt;strong&gt;HTTPSFile&lt;/strong&gt; are subclasses of &lt;strong&gt;File&lt;/strong&gt;. Please provide the &lt;strong&gt;code&lt;/strong&gt; for the Simple Factory called &lt;strong&gt;FileFactory&lt;/strong&gt; that has 1 method:
public File getFile(String str).&lt;/p&gt;
&lt;p&gt;BTW Java Strings have a method: public boolean startsWith(String prefix)&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise Mock Objects</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_20200323_MockObjects.html" rel="alternate"/><published>2020-03-23T00:00:00+05:00</published><updated>2020-03-23T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2020-03-23:/lums-cs360/archive/class_participation_20200323_MockObjects.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;Submit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;as&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;online&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;

&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;CS360&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Mock&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb nb-Type"&gt;Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Quiz&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;You&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;probably&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;have&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;use&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;back&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;quiz&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;WeatherService&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;that&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;gets&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;webservice&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;It&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;parses&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;webpage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;produces&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;But&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sometimes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;you&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;don&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;t have&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;network&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;conenctivity&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;sometimes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;webservice&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;goes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;down&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Sometimes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;some&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;locations&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;are&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;supported&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;by&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;Your&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;boss&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;wants&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;you&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;against&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;some&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;these&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;issues&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;1.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mock&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;enable&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;testing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;retrieveWeather&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;2.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;testCase&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;using&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mock&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ensures&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;that&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="n"&gt;returns&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;that&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;LocationException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;thrown&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;3.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;testCase&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;using&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;mock&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ensures&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;that&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="n"&gt;returns&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;that&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;NoServiceException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;thrown&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;
&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="n"&gt;Do&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;modify&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;any&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;existing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;You&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;may&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;only&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;NEW&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;WebserviceException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;extends&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;LocationException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;extends&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;WebserviceException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;NoServiceException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;extends&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;WebserviceException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb nb-Type"&gt;int&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb nb-Type"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;HTTPGetter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;Page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb nb-Type"&gt;String&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;WeatherService&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;HTTPGetter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;httpGet&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;WeatherService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;HTTPGetter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;getter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;httpGet&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;getter&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;protected&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;parseWeather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;retrieveWeather&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;throws&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;WebserviceException&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="n"&gt;Page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;httpGet&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;baseURL&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/” + Location.getCurrentLocation().toString());&lt;/span&gt;
&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;             &lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="w"&gt;             &lt;/span&gt;&lt;span class="n"&gt;throw&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;LocationException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Location not supported!”); // TEST ME!&lt;/span&gt;
&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;             &lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="w"&gt;             &lt;/span&gt;&lt;span class="n"&gt;throw&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;NoServiceException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Service not reachable!”); // TEST ME!&lt;/span&gt;
&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="n"&gt;Weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weather&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;parseWeather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;weather&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry><entry><title>Class Participation Exercise Command Pattern</title><link href="https://lums-cs360-web.github.io/lums-cs360/archive/class_participation_20200320_CommandPattern.html" rel="alternate"/><published>2020-03-20T00:00:00+05:00</published><updated>2020-03-20T00:00:00+05:00</updated><author><name>Dr Abdul Ali Bangash</name></author><id>tag:lums-cs360-web.github.io,2020-03-20:/lums-cs360/archive/class_participation_20200320_CommandPattern.html</id><summary type="html">&lt;p&gt;Individual, Assignments, Participation&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;ol&gt;
&lt;li&gt;Draw the UML Class diagram for
   commands that you expect would
   exist inside of a text editor.&lt;/li&gt;
&lt;li&gt;Give example code of how you
   would fill in the CutMenuListener's
   void menuAction() Method of the
   Edit Menu's "Cut MenuItem"&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="n"&gt;CutMenuListener&lt;/span&gt; {
// &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;called&lt;/span&gt; &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;Cut&lt;/span&gt; &lt;span class="n"&gt;menu&lt;/span&gt; &lt;span class="nb"&gt;item&lt;/span&gt; &lt;span class="nb"&gt;in&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;Edit&lt;/span&gt; &lt;span class="n"&gt;Menu&lt;/span&gt;
// &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;clicked&lt;/span&gt; &lt;span class="o"&gt;or&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="nb"&gt;key&lt;/span&gt; &lt;span class="n"&gt;combo&lt;/span&gt; &lt;span class="n"&gt;ctrl-X&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;pressed&lt;/span&gt;.
    &lt;span class="n"&gt;public&lt;/span&gt; &lt;span class="n"&gt;void&lt;/span&gt; &lt;span class="n"&gt;menuAction&lt;/span&gt;() {

    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Submit your drawing as a PNG file.&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="https://lums-cs360-web.github.io/lums-cs360/archive/CommandPattern.png" style="margin: 20px;" width="500"&gt;&lt;/p&gt;</content><category term="archive"/><category term="resources"/><category term="participation"/><category term="references"/><category term="practice"/></entry></feed>