Questions
Make a function that swaps the values that change the values between the parameters as the...

  • Make a function that swaps the values that change the values between the parameters as the following rule.

  • The functions swap takes 2, 3 or 4 parameters and these functions are implemented as the overloading functions.

    • swap(int &, int &) : change the values each other.
      swap(int &, int &, int &) : change the value with the order. [min, medium, max]
      swap(int &, int &, int &, int &) : change the value like circular-shift-right [A, B, C, D] = > [B, C, D, A]
    • For Example,
      • num1 = 15; num2 = 5; num3 = 30; num4 =40;
      • swap(num1, num2);
        • num1 will be 5 and num2 will be 15
      • swap(num1, num2, num3)
        • num1 will be 5, num2 will be 15, and num3 is 30
      • swap(num1, num2, num3, num4)
        • num1 is 5, num2 is 30, num3 is 40 and num4 is 15

In: Computer Science

Write a Python program in a file called consonants.py, to solve the following problem using a...

Write a Python program in a file called consonants.py, to solve the following problem using a nested loop. For each input word, replace each consonant in the word with a question mark (?). Your program should print the original word and a count of the number of consonants replaced. Assume that the number of words to be processed is not known, hence a sentinel value (maybe "zzz") should be used. Sample input/output:

Please enter a word or zzz to quit: Dramatics

The original word is: dramatics

The word without consonants is: ??a?a?i??

The number of consonants in the word are: 6

Please enter another word or zzz to quit: latchstring

The original word is: latchstring

The word without consonants is: ?a??????i??

The number of consonants in the word are: 9

Please enter another word or zzz to quit: YELLOW

The original word is: yellow

The word without consonants is: ?e??o?

The number of consonants in the word are: 4

Please enter another word or zzz to quit: zZz

In: Computer Science

How do I count CAG number in DNA using python? please provide an example!

How do I count CAG number in DNA using python? please provide an example!

In: Computer Science

Use Python 3, please type. Write a Python 3 program which is an arithmetic quiz for...

Use Python 3, please type.

Write a Python 3 program which is an arithmetic quiz for children. The program asks the user to calculate the multiplication of two numbers generated at random in your code. The numbers should be in the range 1 through 10. User input is shown in bold black font in the example below.

You will need to use random numbers. You should type the recommended comments at the top of your code and include three test runs in the comments.

Example program run:

Please enter the result of multiplying 6 x 7 :

42

Correct.

Another question? (y/n):

y

Please enter the result of multiplying 2 x 7 :

13

Incorrect.

Another question? (y/n):

n

You scored 1 out of 2. That is 50% and letter grade": P

In: Computer Science

Please fill the following blank with a proper “option” so that the sizes of the files...

Please fill the following blank with a proper “option” so that the sizes of the files can be displayed in either K or M units as shown below.

$ ls –l –S -r ______________________ /bin | tail -2

-rwxr-xr-x 1 root root 998K 2017-05-16 bash

-rwxr-xr-x 1 root root 1.9M 2019-03-27 busybox

$

In: Computer Science

Write a program that counts the letters in a given string and then display the letter...

Write a program that counts the letters in a given string and then display the letter count in order from high to low.

The program should:

  • Display a message stating its goal
  • Prompt the user to enter a string input
  • Count the letters in the string (hint: use dictionaries)
  • Display the letter count in order from high to low (sort your letter count)
  • For example, for the input Google the output should be

G - 2

O - 2

E - 1

L - 1

  • Note:
    • Make sure not to count lowercase and uppercase twice (i.e., G an g should be count together)
    • Bonus: if a few letters have the same count, sort the display in an alphabetic order (like in the example)
  • Make sure to include comments that explain all your steps (starts with #). Also use a comment to sign your name at the beginning of the program!

In: Computer Science

In Java Create a simple GUI that gets the exam score and shows the corresponding letter...

In Java

Create a simple GUI that gets the exam score and shows the corresponding letter grade by clicking on the “Convert Score to Letter Grade” button.

In: Computer Science

You must create two Java files. One is called LastNameFirstNameWeek6Prog.java, and the other is called  Museum.java. Ensure...

You must create two Java files. One is called LastNameFirstNameWeek6Prog.java, and the other is called  Museum.java.

Ensure you include ALL files required to make your program compile and run. I would like to see your .java files only.

5%

Museum.java Class File

1.    Create a new class called Museum that describes a Museum and includes the functionality below

2.    The new class has the following five attributes:
a. officialName – the museum’s given name (i.e.:“ New Orleans Museum of Arts”,etc.), type String
b. specialty – the museum’s type (i.e.:“Art”, “Science”, etc.), type String
c. numberOfBuildings – the number of buildings in the museum, type integer
d. area – the museum’s area in square feet, type double
e. financed - type boolean - true if the museum is financed by patrons, false if not.
Use these names for attributes exactly as given here. All attributes must be private.

3.    Be sure your classes have a good set of accessor and mutator methods. Every member variable must have at least one independent accessor and one independent mutator. (see document on Program help for examples)

Ensure you use the “this” reference from within this class when referring to every instance variable or instance method of the current object.

45%

LastNameFirstNameWeek6Prog.java Class File (Driver Program)

Write a driver program that reads information from the user about 3 museums and use this info to create 3 respective Museum objects. The following information should be read from the user per Museum:
official name
specialty
number of buildings
area in square feet
is the museum financed?

After this, using the information inside the objects the program, the driver program should evaluate and print the following output:

·        The average area of the three Museums

·        The minimum and maximum number of buildings among all the Museums

·        The name of the financed Museum with the most area.

To get the information from the objects, use accessor methods from the Museum class. Do not use local variables in main for these calculations. You may use local variables to read the information from the user, but once this information is set on the Museum objects, you must use the get methods to retrieve the information from the objects themselves.

Also do not use Arrays or any other advanced concept that was not reviewed in the class to solve this assignment. Assignments that use these concepts will only be graded 10% for presentation.

45%

NOTE: Complete your activity and submit it by clicking on "Submit Assignment".

5%

Total Possible Points

100

Example output of your program

Example Run:

Enter the official name for Museum 1: New Orleans Museum of Arts
Enter the specialty for Museum 1: Art
Enter the number of buildings for Museum 1: 3
Enter the area of the Museum 1 in square feet: 5000
Is Museum 1 financed? true or false?: true

Enter the official name for Museum 2: D-Day Museum
Enter the specialty for Museum 2: History
Enter the number of buildings for Museum 2: 2
Enter the area of the Museum 2 in square feet: 3000
Is Museum 2 financed? true or false?: false

Enter the official name for Museum 3: The Louvre
Enter the specialty for Museum 3: Art
Enter the number of buildings for Museum 3: 25
Enter the area of the Museum 3 in square feet: 100000
Is Museum 3 financed? true or false?: true

The museums average area is 36000.0
The museums minimum number of buildings is: 2
The museums maximum number of buildings is: 25
The financed museum with largest area is: The Louvre with 100000.0 square feet

In: Computer Science

what is Q learning ? how it is related to reinforcement learning ? whats the benfit...

what is Q learning ?
how it is related to reinforcement learning ?
whats the benfit of Q learing and why it important ?
provide an example of Q learning using robotics?   

In: Computer Science

Based on the tables below, write SQL command to perform the following tasks for MySql: Create...

  1. Based on the tables below, write SQL command to perform the following tasks for MySql:
  1. Create SALESREP and CUSTOMER tables
  2. Create primary and foreign keys as appropriate. The custNo should use a surrogate key as the primary key with auto-increment
  3. increase the balance of the Gonzales account by $100 to a total of $450?
  4. Find an average customer balance
  5. Display the name of the sales representative and the name of the customer for each customer that has a balance greater than 400

SALESREP

SalesRepNo

RepName

HireDate

654

Jones

01/02/2005

734

Smith

02/03/2007

345

Chen

01/25/2004

434

Johnson

11/23/2004

CUSTOMER

CustNo

CustName

Balance

SalesRepNo

9870

Winston

500

345

8590

Gonzales

350

434

7840

Harris

800

654

4870

Miles

100

345

In: Computer Science

Use Python, please type. A multiple-choice quiz with 5 questions. Each question has 4 possible answers...

Use Python, please type.

A multiple-choice quiz with 5 questions. Each question has 4 possible answers labelled A, B, C and D.   

After displaying the first question and the 4 possible answers, the user is asked to enter their choice. If their choice is correct, add 1 to the score, then display the next question and its 4 possible answers.

At the end of the quiz, display their score out of 5, their score as a percentage, and if they get a percentage score greater than or equal to 50, your program should output "You passed this quiz, well done!", otherwise the output is "You failed this time, better luck next time!"

Also, output the student's letter grade according to this scale:

A+  91-100      C+  65-69
A   86-90       C   60-64
A-  80-85       C-  55-59
B+  77-79       P   50-54
B   73-76       F   Below 50
B-  70-72

1. Which of the following is the name of an intermediate level language?

A: C++

B: Java

C: PHP

D: Assembly

Please enter your answer, A, B, C or D:

Answer: D

2. Which of the following is not an output device?

A: Monitor

B: Printer

C: Projector

D: Mouse

Please enter your answer, A, B, C or D:

Answer: D

3. Which of the following symbol is used for comments in Python?

A: @

B: **

C: #

D: /*

Please enter your answer, A, B, C or D:
Answer: C

4. What is the output of 13 % 3 in python 3?

A: 1

B: 3

C: 4

D: 6

Please enter your answer, A, B, C or D:
Answer: A

5. What is the output of 17//2 in python 3?

A: 7

B: 8

C: 9

D: 9.5

Please enter your answer, A, B, C or D:

Answer: B

In: Computer Science

(BASH) Say I have an array of strings with about 100 numbers ranging in length from...

(BASH) Say I have an array of strings with about 100 numbers ranging in length from 3-6 that represent some sort of ID. Within the array of strings, there are some duplicates numbers. What I am trying to do is represent only the top 12 numbers in the form (ID, count occurence) where its ranked by the count occurrences. So the first number would not be the ID with the most digits but it would be the one with the most occurrences.  Is there a way to do this with AWK , begin? or how could i approach this problem?

In: Computer Science

Draw the NFA for language L2 = { w | w ends in 12}. Alphabet {0,1,2}

Draw the NFA for language L2 = { w | w ends in 12}. Alphabet {0,1,2}

In: Computer Science

What is a database? Why do today’s Internet Web applications and smartphone apps need databases? For...

  1. What is a database? Why do today’s Internet Web applications and smartphone apps need databases?
  2. For the tables given as: MEMBER (MemberNumber, MemberFirstName, MemberLastName, EmailAddress)

And PAYMENT (PaymentNumber, MemberNumber, PaymentDate, PaymentAmount)

what are the primary keys of each table? Do you think that any of these primary keys could be surrogate keys? Are any of these keys composite keys? Explain how the two tables are related. Which table contains the foreign key, and what it is the foreign key?

  1. Define the terms data and information.   Explain how the two terms differ.

In: Computer Science

1. MySQL can enforce referential integrity for a delete operation performed on a parent table record...

1. MySQL can enforce referential integrity for a delete operation performed on a parent table record by ____________________ .

A. returning an error instead of deleting any rows.

B. setting the foreign key values in the related child table rows to null.

C. deleting the related rows in the corresponding child table(s).

D. applying any one of the above, (a, b or c), depending on how the foreign key constraint is defined.

2. Third normal form (3NF) eliminates which of the following issues in a table?

A. Transitive dependencies

B. Functional dependencies

C. Partial dependencies

D. Repeating, or multi-valued columns

3. For a table to be in the second normal form (2NF), each non-primary key column in the table must __________________

A. depend on only one column that is part of the composite primary key of the given table.

B. depend on all columns that make up the composite primary key of the given table.

C. have a unique value.

D. have a non-NULL value.

In: Computer Science