Questions
Would you allow yourself to be connected to Nozick’s “Experience Machine” for the rest of your...

Would you allow yourself to be connected to Nozick’s “Experience Machine” for the rest of your life? Why or why not? What do you believe this thought-experiment shows us about what we find important in life?

In: Psychology

Case Study: University Library System This case is a simplified (initial draft) of a new system...

Case Study: University Library System
This case is a simplified (initial draft) of a new system for the University Library. Of course, the library system must keep track of books. Information is maintained about both book titles and the individual book copies. Book titles maintain information about title, author, publisher, and catalog number. Individual copies maintain copy number, edition, publication year, ISBN, book status (whether it is on the shelf or loaned out), and date due back in.
The library also keeps track of patrons to the library. Since it is a university library, there are several types of patrons, each with different privileges. There are faculty patrons, graduate student patrons, and undergraduate student patrons. Basic information about all patrons is name, address, and telephone number. For faculty patrons, additional information is office address and telephone number. For graduate students, information such as graduate program and advisor information is maintained. For undergraduate student’s program and total credit hours are maintained.
The library also keeps information about library loans. A library loan is a somewhat abstract object. A loan occurs when a patron approaches the circulation desk with a stack of books to check out. Over time a patron can have many loans. A loan can have many physical books associated with it. (And a physical book can be on many loans over a period of time. Information about past loans is kept in the database.) So, in this case, it is recommended that an association class be created for loaned books.
If a book is checked out that a patron wants, he/she can put that title on reserve. This is another class that does not represent a concrete object. Each reservation is for only one title and one patron. Information such as date reserved, priority, and date fulfilled is maintained. When it is fulfilled, the system associates it with the loan on which it was checked out.
For this case, develop the following diagrams:

1. Use Case description for checking out books with one any exceptional case

In: Computer Science

We will do some basic data analysis on information stored in external files. You will find...

We will do some basic data analysis on information stored in external files.

You will find the following data files in the Source Code -> Chapter 7 folder you should have downloaded already downloaded/unzipped in Lesson 3. If you need that link again:

Pyton4E_Source_Code.zip

GirNames.txt
contains a list of the 200 most popular names given to girls born in US from year 2000 thru 2009

BoyNames.txt
contains a list of the 200 most popular names given to boys born in US from year 2000 thru 2009

Hint: See Program 7-15 read_list.py for example of reading a file's contents into a list and using a loop to strip each \n

Here is the high-level algorithm (you still have work to do :)

open BoyNames.text for reading
read all lines into a list
close the file

while there are elements in list
strip the \n from each element

open GirlNames.txt for reading
read all lines into a list
close file
while there are elements in list
strip \n from each element
get user input for boy
get user input for girl
display result for boy's name entered by user (you need a decision structure as output depends on user input)
display result for girl's name entered by user (you need a decision structure as output depends on user input)

Input: a boy's name, a girl's name, or 'N' for none
Output: messages indicating whether the names were among the most popular

Note: Use a try/except to catch IOError
as anytime we deal with external files, problems may occur (file doesn't exist, we don't have permissions, disk is corrupted, and so on).


Sample Input/Output

IMPORTANT NOTE: The external files MUST be in same directory as your source code.

You may run your code on the command line/system prompt (as I have done) OR from IDLE (Run->Run Module or F5).

Here is first run showing output when user input for both boy and girl are popular names (user input shown in italics/bold ).

Enter a boy's name, or N if you do not wish to enter a boy's name: Michael
Enter a girl's name, or N if you do not wish to enter a girl's name: Emma
Michael is one of the most popular boy's names.
Emma is one of the most popular girl's names.

Here is a second run where user says 'N' to entering names

$ python babyname.py
Enter a boy's name, or N if you do not wish to enter a boy's name: N
Enter a girl's name, or N if you do not wish to enter a girl's name: N
You chose not to enter a boy's name.
You chose not to enter a girl's name.


Here is third run showing user input with a girl name not in the GirlNames.txt file:

$ python babyname.py
Enter a boy's name, or N if you do not wish to enter a boy's name: John
Enter a girl's name, or N if you do not wish to enter a girl's name: Ada
John is one of the most popular boy's names.
Ada is not one of the most popular girl's names.

Note: We will test code with THREE sample runs:

  • First run uses the names Michael and Emma (see sample run above)
  • Second run user enters N for both of the prompts (answer N for boys and N for girls)
  • Third run we enter names of our choice but at least one is NOT popular.

this is what i did for this assignment but i got some error could you please help me with it

def main():
#open BoyNames.text for reading
infile = open('BoyNames.text', 'r')
#read all lines into a list
BoyNames = infile.readlines()
#close the file
infile.close()
#while there are elements in list
#strip the \n from each element
index = 0
while index < len(BoyNames):
BoyNames[index] = BoyNames[index].rstrip('\n')
index += 1
  

#open GirlNames.txt for reading
infile = open('GirlNames.txt', 'r')
#read all lines into a list
GirlNames = infile.readlines()
#close the file
infile.close()
# while there are elements in list
# strip \n from each element
index = 0
while index < len(GirlNames):
GirlNames[index] = GirlNames[index].rstrip('\n')
index += 1
  
#get user input for boy
try:
BoyName = input ("Enter a boy's name, or N if you do not wish to enter a boy's name:")
print (BoyNames)

GirlName = input ("Enter a gilr's name, or N if you do not wish to enter a girl's name:")
print (GirlNames)

except IOError:
print ("You chose not to enter a girl's name.")

  

main()

In: Computer Science

If z=x2y- 9xy2 and x=u2+euw, y=v2+2uv, when u=1, v=-1, w=0, then Zu=

If z=x2y- 9xy2 and x=u2+euw, y=v2+2uv, when u=1, v=-1, w=0, then Zu=

In: Math

Find the directional derivative of the function at the given point in the direction of the...

Find the directional derivative of the function at the given point in the direction of the vector v. ? = (2? + 3?)2, ? ⃑ = 1 2 ? ⃑+ √3 2 ? ⃑, (-1,1,1)

In: Math

How to set up procedures for a Thermal Charge-Transfer Reduction of Uranyl (VI) to Uranyl (V)...

How to set up procedures for a Thermal Charge-Transfer Reduction of Uranyl (VI) to Uranyl (V) with reducing agents with UV-Vis Spectrometer

In: Chemistry

explain the case Letendre v Deines Micro- Film Services Ltd , 2001 ABQB 26 according to...

explain the case Letendre v Deines Micro- Film Services Ltd , 2001 ABQB 26 according to employment law on the basis of termination

In: Advanced Math

Describe the strategy behind the Double V campaign. How did it enable African Americans to protest...

Describe the strategy behind the Double V campaign. How did it enable African Americans to protest their circumstances without risking accusations of disloyalty?


In: Economics

What are the issues in the following case and what laws pertain to it? Fletcher v...

What are the issues in the following case and what laws pertain to it?
Fletcher v South Peninsula

sidenote-this case is about a patient and a hospital staff

In: Economics

What specific law applies to the following case and what was the overall conclusion of the...

What specific law applies to the following case and what was the overall conclusion of the case:

Fletcher v. South Peninsula
(case is about health)

In: Economics