ITS 3105 SUS C Programming Ethics of Artificial Intelligence Paper & Reflection

User Generated

EblnyErory

Programming

ITS 3105

South University Savannah

ITS

Description

read the description of the Eliza program at the bottom of this question. Is it ethical to make people think they are talking to another person when they are not? Does it make a difference if they find the program to be helpful? Would you mind if a Help facility for some software you were using was a machine instead of a person? Have you ever been embarrassed when you thought you were talking to a person but later found out you were not? (For example, have you ever started to respond on the phone only to realize you were listening to an answering machine?)

import javax.swing.*;
public class Eliza
{
   public static void main(String[] args)
   {
      String user;
      String msg = "";
      String msg1 = "Tell me more about your ";
      String msg2 = "You seem to have strong feelings about that";
      String msg3 = "Please go on";
      String msg4 = "Tell me more";
      String msg5 = "Continue";
      int random;
      int length;
      int x, y;
      int stopWord;
      final String END = "Goodbye";
      boolean foundMy = false, foundLove = false, foundHate = false;
      user = JOptionPane.showInputDialog(null,
       "Hello. I am Eliza, your tharapist. Tell me what" +
       "\nis troubling you. Any time you want to quit," +
       "\njust type \"Goodbye\"");
      while(!user.equalsIgnoreCase(END))
      {
        user = user.toLowerCase();
        length = user.length();
        foundMy = false;
        for(x = 0; x < length - 3; ++x) // If "my" is at end of sentence, no need to go further
        {
          if(user.charAt(x) == 'm')
          {
            if(user.charAt(x + 1) == 'y')
              if(user.charAt(x + 2) == ' ')
                if(x >= 1)
          {
                  if(user.charAt(x - 1) == ' ')
                       foundMy = true;
          }
          else
            foundMy = true;
      }
      if(foundMy)
      {
         stopWord = length;
         for(y = x + 3; y < length; ++y)
         {
             if(user.charAt(y) == ' ' || user.charAt(y) == '.' || user.charAt(y) == ',')
                   stopWord = y;
         }
         msg = msg1 + user.substring(x + 3, stopWord);
         x = length;  // do not look for possible second "my"
         }
      }
      if(!foundMy)
      {
         foundLove = false;
         for(x = 0; x < length - 5; ++x)
         {
           if(user.charAt(x) == 'l')
           {
             if(user.charAt(x + 1) == 'o')
              if(user.charAt(x + 2) == 'v')
               if(user.charAt(x + 3) == 'e')
                if(user.charAt(x + 4) == ' ')
                 if(x >= 1)
                 {
                   if(user.charAt(x - 1) == ' ')
                     foundLove = true;
                  }
                  else
                     foundLove = true;
             }
             if(foundLove)
             {
               msg = msg2;
               x = length;  // do not look for possible second "love"
             }
         }
     }
     if(!foundLove && !foundMy)
     {
        foundHate = false;
         for(x = 0; x < length - 5; ++x)
         {
           if(user.charAt(x) == 'h')
           {
            if(user.charAt(x + 1) == 'a')
             if(user.charAt(x + 2) == 't')
              if(user.charAt(x + 3) == 'e')
               if(user.charAt(x + 4) == ' ')
                if(x >= 1)
                {
                 if(user.charAt(x - 1) == ' ')
                   foundHate = true;
                 }
                 else
                   foundHate = true;
         }
         if(foundHate)
         {
           msg = msg2;
           x = length;  // do not look for possible second "hate"
          }
      }
  }
   if(!foundHate && !foundLove && !foundMy)
  {
        random = (int) (Math.random() * 100) % 3;
        if(random == 0)
           msg = msg3;
        else
           if(random == 1)
              msg = msg4;
            else
               msg = msg5;

       }                     
       user = JOptionPane.showInputDialog(null, msg);              

      }
    JOptionPane.showMessageDialog(null, END);
  }
}

Learning Journal entry 

Use the following questions as guides to self-reflection during this week:

  • Briefly describe what programming you did this week.
  • Describe any problems you have had and how you solved your problems.
  • What skills and knowledge do you recognize that you are gaining, and how will these skills and knowledge be useful in school and as a professional after school?

Explanation & Answer:
1 Paper 1 Reflection 250 Words Each
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Attached.

Running head: SELF-REFLECTION

1

Self-Reflection
Student Name
Institution Affiliation

During this week, I have learned much about Object-Oriented Programming. I am in a
position to create a reusable code through the use of classes and loops. Object-oriented
programming eliminates hard coding because a program designed using OOP can be modified
accordingly to meet the specific needs, thus eliminating duplication of code.
However, at first, I faced various challenges. It was a bit puzzling to differentiate between
an object, a class, and how to use instantiation. As a result, it was somehow difficult to apply
Object oriented programming to create a program. Through determination, perseverance, and a lot
of practice, I managed to gain an understanding of what Object Oriented Programming is all about.
Casual assistance from classmates and Faculty made me discover new approaches to OOP.
Moreover, through practice, I was able to create a fully func...


Anonymous
Really helped me to better understand my coursework. Super recommended.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags