Question

In: Computer Science

Programming Human Concentration Human contains a brain that has several thought areas. Awareness is defined by...

Programming Human Concentration Human contains a brain that has several thought areas. Awareness is defined by understanding (focusing) of a thought area, and Concentration is defined focusing your awareness into a thought area for a longer duration of time. Using Object-Oriented Design, program this concept to demonstrate concentration.

Design Using Object Oriented Principles ---------------------------------------

Let's first think through all the Classes to be created: 1. Human 2. Brain 3. ThoughtArea You can consider defining properties in each of these classes. Following methods should be written for this project.

You have to decide which classes to put the methods in

1. awareness() 2. focus() 3. concentration()

Design two test cases to show concentration.

Grading Criteria 1. Object Oriented Programming principles are used. 2. Coding conventions are followed. 3. Test runs are provided. 4. Class diagrams are provided.

Solutions

Expert Solution

Code:

import java.io.*;
class Brain
{
   public static String awareness(String behaviour)
   {
       if(behaviour.equalsIgnoreCase("Aggresive"))
       {
           return "High";
       }
       else if(behaviour.equalsIgnoreCase("Assertive"))
       {
           return "Medium";
       }
       else if(behaviour.equalsIgnoreCase("Passive"))
       {
           return "Low";
       }
       else
       {
           return null;
       }
   }
}
/*
In the below class ThoughArea class extends the Brain class where Brain class is
superclass and ThoughArea class is subclass ThoughArea class gets
all the properties of the Brain class due to java inheritance
*/
class ThoughArea extends Brain
{
   public static String focus(String behaviour)
   {
       if(behaviour.equalsIgnoreCase("Aggresive"))
       {
           return "Medium";
       }
       else if(behaviour.equalsIgnoreCase("Assertive"))
       {
           return "Low";
       }
       else if(behaviour.equalsIgnoreCase("Passive"))
       {
           return "High";
       }
       else
       {
           return null;
       }
   }
   public static String concentration(String behaviour)
   {
       if(behaviour.equalsIgnoreCase("Aggresive"))
       {
           return "Low";
       }
       else if(behaviour.equalsIgnoreCase("Assertive"))
       {
           return "High";
       }
       else if(behaviour.equalsIgnoreCase("Passive"))
       {
           return "Medium";
       }
       else
       {
           return null;
       }
   }
}
class Human
{
   public static void main(String args[])throws IOException
   {
       //This below line used to create buffered reader to read input from the keyboard
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       String name,age,height,behaviour;
       System.out.print("Enter Name:");
       //This below line read input from the keyboard in the form of string
       name=br.readLine();
       System.out.print("\nEnter Age:");
       age=br.readLine();
       System.out.print("\nEnter Height:");
       height=br.readLine();
       System.out.print("\nEnter Behaviour:");
       behaviour=br.readLine();
       System.out.println("---------------------------");
       System.out.println("Summary");
       System.out.println("---------------------------");
       System.out.println("Name: "+name);
       System.out.println("Age: "+age);
       System.out.println("Height: "+height+"inches");
       System.out.println("Behaviour: "+behaviour);
       //This below line calls the function awareness in the ThoughArea class and print the result
       System.out.println("Awareness: "+ThoughArea.awareness(behaviour));
       //This below line calls the function focus in the ThoughArea class and print the result
       System.out.println("Focus: "+ThoughArea.focus(behaviour));
       //This below line calls the function concentration in the ThoughArea class and print the result
       System.out.println("Concentration: "+ThoughArea.concentration(behaviour));

   }
}

Code Snippet:

Output :

Class Diagram:


Related Solutions

Draw diagrams of the human brain from different aspects, labeling the location, function and Brodmann’s areas...
Draw diagrams of the human brain from different aspects, labeling the location, function and Brodmann’s areas of all the listed cerebral cortex regions.
The average human body contains 6.30 L of blood with a Fe2+ concentration of 1.60×10−5M ....
The average human body contains 6.30 L of blood with a Fe2+ concentration of 1.60×10−5M . If a person ingests 9.00 mL of 13.0 mM NaCN, what percentage of iron(II) in the blood would be sequestered by the cyanide ion?
The average human body contains 5.70 L of blood with a Fe2+ concentration of 2.10×10−5M ....
The average human body contains 5.70 L of blood with a Fe2+ concentration of 2.10×10−5M . If a person ingests 10.0 mL of 25.0 mM NaCN, what percentage of iron(II) in the blood would be sequestered by the cyanide ion? Express the percentage numerically.
1) The average human body contains 5.70 L of blood with a Fe2+ concentration of 2.60×10−5...
1) The average human body contains 5.70 L of blood with a Fe2+ concentration of 2.60×10−5 M . If a person ingests 12.0 mL of 16.0 mM NaCN, what percentage of iron(II) in the blood would be sequestered by the cyanide ion? (When species combine to produce a coordination complex, the equilibrium constant for the reaction is called is the formation constant, Kf. For example, the iron(II) ion, Fe2+, can combine with the cyanide ion, CN−, to form the complex...
The average human body contains 5.50 L of blood with a Fe2+ concentration of 2.20×10−5 M...
The average human body contains 5.50 L of blood with a Fe2+ concentration of 2.20×10−5 M . If a person ingests 9.00 mL of 21.0 mM NaCN, what percentage of iron(II) in the blood would be sequestered by the cyanide ion?
The average human body contains 5.10 L of blood with a Fe2+ concentration of 3.20×10−5 M...
The average human body contains 5.10 L of blood with a Fe2+ concentration of 3.20×10−5 M . If a person ingests 11.0 mL of 25.0 mM NaCN, what percentage of iron(II) in the blood would be sequestered by the cyanide ion?
The average human body contains 6.50 L of blood with a Fe2+ concentration of 2.50×10^−5 M...
The average human body contains 6.50 L of blood with a Fe2+ concentration of 2.50×10^−5 M . If a person ingests 12.0 mL of 17.0 mM NaCN, what percentage of iron(II) in the blood would be sequestered by the cyanide ion? For example, the iron(II) ion, Fe2+Fe2+, can combine with the cyanide ion, CN−CN−, to form the complex [Fe(CN)6]4−[Fe(CN)6]4− according to the equation Fe2+(aq)+6CN−(aq)⇌[Fe(CN)6]4−(aq)Fe2+(aq)+6CN−(aq)⇌[Fe(CN)6]4−(aq) where Kf=4.21×10^45 This reaction is what makes cyanide so toxic to human beings and other animals....
8. Tuberculosis The genus mycobacterium contains over 50 species with several human pathogens of concern. Mycobacteria...
8. Tuberculosis The genus mycobacterium contains over 50 species with several human pathogens of concern. Mycobacteria are distinguishable from other types of bacteria by the presence of wax layers and high molecular weight fatty acids (mycolic acids). This complex, external structure offers protection from acids, drying and some germicides. In fact, mycobacteria are also referred to as acid-fast bacilli because acid treatments will not result in decolorization during staining. One of the mycobacteria species of medical interest is Mycobacterium tuberculosis,...
modern neuroscience, which has revealed the "plasticity" of the human brain, shows that our habitual practices...
modern neuroscience, which has revealed the "plasticity" of the human brain, shows that our habitual practices can actually change our neuronal structures. The brains of illiterate people, for example, are structurally different from those of people who can read. So if the technology and its concomitant requirement to learn to read – could shape human brains, then surely it's logical to assume that our addiction to networking technology will do something similar? Do you agree?
Nursing has been strongly influenced by several philosophical schools of thought including the received view, the...
Nursing has been strongly influenced by several philosophical schools of thought including the received view, the perceived view, and postmodernism. Based on your readings, (2) which school(s) of thought do you believe best supports your practice in nursing? Provide a clear rationale to support your response.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT