Questions
You're a statistics professor and the deadline for submitting your students' grades is tonight at midnight....

You're a statistics professor and the deadline for submitting your students' grades is tonight at midnight. Each student's grade is determined by their mean score across all of the tests they took this semester.

(The mean is the average of the numbers. It is easy to calculate: add up all the numbers, then divide by how many numbers there are)

You've decided to automate grade calculation by writing a Python program that takes a list of test scores and prints a one character string representing the student's grade calculated as follows:

90% <= mean score <= 100%: "A",
80% <= mean score < 90%: "B",
70% <= mean score < 80%: "C",
60% <= mean score < 70%: "D",
mean score < 60%: "F"

For example, if list1 = [92, 94, 99], it would print "A" since the mean score is 95, and if list1 = [50, 60, 70, 80, 90], it would return "C" since the mean score is 70.

In: Computer Science

Write a java program with 3 recursive methods that reverse the order of a string. The...

Write a java program with 3 recursive methods that reverse the order of a string. The first recursive method should reverse the order starting from the left selecting the leftmost character as the head and the remaining part of the string as its tail., the second starting from the right selecting the rightmost character as the head and the remaining part of the string on its left as the tail, and the last a recursive method starting from the middle by extract two characters simultaneously from both left and right.

In: Computer Science

Show that the multi-version read consistency algorithm ensures serializability. That is, read-only transactions use the multi-version...

Show that the multi-version read consistency algorithm ensures serializability. That is, read-only transactions use the multi-version technique whereas read-write transactions use strict two phase locking.

In: Computer Science

Consider a nuclear reactor whose temperature is monitored by three sensors. An alarm should go off...

Consider a nuclear reactor whose temperature is monitored by three sensors. An alarm should go off if any two of the sensor readings disagree by more than 5°F. Write a program that would print a string ‘ALARM’ if any two temperate readings disagree by strictly more than 5°F and ‘NORMAL’ otherwise

Ask for each temperature input and display the state

Use MATLAB

In: Computer Science

Java Programming Project 6: File I/O Purpose: To practice reading from as well as writing to...

Java Programming Project 6: File I/O

Purpose: To practice reading from as well as writing to text files with the help of Scanner class methods, and PrintStream class methods. You will also learn to implement some simple Exception Handling.

Carefully examine and follow ALL the program specifications.

Take a look at the PPT slides for Chapter 7 File I/O for examples that will help with this program.

Hotel Expense Recording Keeping:

A hotel bookkeeper enters client hotel expenses in a text file. Each line contains the following, separated by semicolons: client name, service sold (i.e., Dinner, Conference, Lodging, etc.), the sales amount, and the date.

  1. Your program should first query the user for the name of the input file and read it in. Display an error if the input file is not found (does not exist).
  2. Then the program should read the file (line by line), keep a running tally of the total amount for each kind of service,
  3. Finally display the total amount for each service category. In addition to displaying totals on the screen, the totals should also be written to an output file.
  4. Additionally your program should include some exception handling. An Exception that should be checked (and handled) would be a FileNotFoundException.

Attached (and below) is an example input file that your program will be tested with, so you will need to make sure that you program will run correctly using this file. Since this may be your first experience reading from an input file, you will likely find it easiest if you store the input file in the same folder with your Java program file so that they can easily communicate with one another. The easiest way to store this file is as a plain text file in Notepad (do not use MS word or any other sophisticated word processor or you will be processing embedded text commands, which is not at all recommended). Here is what the input file looks like:

Jason Inouye;Conference;250.00;11/10/2016

Jason Inouye;Lodging;78.95;11/10/2016

Mary Ryan;Dinner;16.95;11/10/2016

Mark Twain;Dinner;25.50;11/10/2016

Mark Twain;Spa;50.00;11/10/2016

Steven Hawking;Conference;250.00;11/10/2016

Steven Hawking;Room Service;45.00;11/11/2016

Steven Hawking;Lodging;78.95;11/11/2016

Ayrton Senna;Room Service;23.20;11/10/2016

Ayton Senna;Dinner;22.50;11/10/2016

Ayton Senna;Lodging;78.95;11/10/2016

One feature of the input file, is that it uses a semicolon (;) to delimit the tokens on each line of input, rather than whitespace. You will need to use a delimiter statement after you construct your line scanner object.

To see how to construct a line scanner object, go to Chapter 7 PowerPoint slide in the Week 13 folder. So for example, if you create an object called lineScan of type Scanner to process tokens on a given line of input, then you could call the useDelimiter method on your lineScan object, as follows:

lineScan.useDelimiter(";");

This will allow you to tokenize each input line based, not on white space delimiters, but using the semicolon as a delimiter instead.

This is what should be in your Output file after you run your program (this file will most likely be located in the same folder as your Java program).

Dinner expenses : 64.95
Lodging expenses : 236.85
Conference expenses : 500.00
Room Service expenses : 68.20
Spa expenses : 50.00

Submission Requirements:

  1. Please be sure to use appropriate prologue comments at the top of your program, Javadoc formatted comments for your methods, as well as inline comments within the body of your code (as needed).

In: Computer Science

Beginning Python Programming - Sorting: Write and test a Python program to print a set of...

Beginning Python Programming - Sorting: Write and test a Python program to print a set of real numbers in descending order. The program should also print out the median of the numbers input and how many numbers were input. The program should read in numbers until a negative number is read. The negative number serves as a sentinel or marker telling the program when to stop reading numbers. The program should then sort the numbers and print them out in order from largest to smallest. Note, the sentinel number is not to be considered as one of the numbers, it should not be printed. The program should be able to handle up to 100 input numbers. If the user attempts to enter more than 100 numbers, the program should print an error message and quit.

In: Computer Science

1. All questions assume the alphabet Σ = { a , b }. a) Give a...

1. All questions assume the alphabet Σ = { a , b }.

a) Give a regular expression representing the language of all strings containing abab as a substring.

b) Give a regular expression representing the language of all strings with an even number of a's or an odd number of b's, such as abab or baabaab.

c) Give a regular expression representing the language of all strings of the form ambn, where m is even and n is odd. Observe that all the a's come before all the b's, which is different than the previous 2 questions. Sample strings are aab, aabbb, aaaab, and bbbbb. (Remember that 0 is even).

d) List the first 10 strings in canonical order of the language in question b above (even number of a's or odd number of b's, where the a's and b's can occur in any order).

e) List the first 10 strings in canonical order of the language in question c above (ambn).

In: Computer Science

C programming problem < purpose: need to find time and space complexities in this problem and...

C programming problem < purpose: need to find time and space complexities in this problem and which function(algorithm) will be used in this problem>

I have to design an efficient algorithm which solves this problem. Also, it needs to include time and space complexities of this algorithm.
There is a matrix (N times N) of integers which rows and columns are sorted in non-decreasing order.
A sorted matrix and integer M will be given and we need to find the position(row,column) of M in this matrix. it's okay to report only one position if there are more than one answers.

when it is 4 times 4 matrix, and integer M is 19

2 29 37 60
9 11 33 87
19 35 17 5
22 15 91 7

the answer will be (3,1)

I need to find an efficient way to find this position

In: Computer Science

Question The given plaintext is “Feistel cipher structure uses the same algorithm for both encryption and...

Question

The given plaintext is “Feistel cipher structure uses the same algorithm for both encryption and decryption”. Write Java or Python code to implement either Monoalphabetic cipher or Hill cipher or Transposition Cipher (Encryption and Decryption) and test your code on given plaintext. User may enter value of key at the command prompt, if required.

In: Computer Science

IN SCHEME Write a function subtract which takes a list of numbers as a parameter and...

IN SCHEME

Write a function subtract which takes a list of numbers as a parameter and returns a list of the differences. So, a list containing the second minus the first, third minus the second, etc.

(subtract '(3 4 10 14 5))

'(1 6 4 -9)

In: Computer Science

Implement in C++ a game called “Your Lucky Number”. The lucky number is calculated based on...

Implement in C++ a game called “Your Lucky Number”. The lucky number is calculated based on an individual’s birth month, day, and year. The algorithm assigns any person a number between 1 and 9. Many people believe that a group of people with the same lucky number share common features. The lucky number is calculated as the sum of digits of the birth month, day, and year numbers. If this sum is not a single digit then you need to keep adding up its digits. Use the C++ functions when you implement the game. Test your program for corrections. To start the game you should enter your full birthdate in the format: month day year, e.g. 9 21 1985. The month is represented by its corresponding integer: January is 1, February is 2, ..., and December is 12. Be sure that your program will verify the input format and print an error message when the format is incorrect (use exceptions), and will ask to re-enter the birthdate again.

The algorithm for calculating the lucky number

(a) Enter the month as an integer from 1 to 12.

(b) Reduce the month, day and year numbers down to a one-digit number by adding all digits in month, day and year numbers, see the example below.

(c) Map the number to the category listed below and display the message on the screen with at least four features for a person in each category. I provided only one feature (as an adjective) for each category and you should complete the list.

(d) Test your program using at least 10 your friends’ or relatives’ birthdays.

(e) Provide statistics in the README file about the results of your testing by giving the percentage of people that confirm that they belong to the category calculated by your program. Write in the README file about what you have learned by writing this assignment. Write also about your (possible) problems, errors or mistakes.

Categories:

1. The Leader: original thinker (add 3 more features)

2. The Mediator: diplomatic (add 3 more features)

3. The Communicator: expressive (add 3 more features)

4. The Teacher: trustworthy (add 3 more features)

5. The Freedom Seeker: adventurous (add 3 more features)

6. The Nurturer: family-oriented (add 3 more features)

7. The Seeker: analytic (add 3 more features)

8. The Power House: authoritative (add 3 more features)

9. The Humanitarian: charitable (add 3 more features)

In: Computer Science

Highway Project Project The Department of Highways in South Carolina was exploring ways to reduce the...

Highway Project Project

The Department of Highways in South Carolina was exploring ways to reduce the road construction costs and developed new contracting processes to allow the road builders to bring new ideas for cutting costs. On one project, the contractor proposed cost-cutting ideas throughout the life of the project. At each phase, the client accepted many of the ideas and then revised the budget. The client promoted the revised cost target of the project as an example of the success of the new process. By the end of the project, the final cost was less than 1 percent over the newest target. Although the total cost of the project was almost 10 percent less than the original cost projections and contract obligations, the success of the project was connected to the new expectations that developed during the life of the project. Even though this project performance exceeded the original goal, the client was disappointed.

Biotech Project

A biotechnology company developed a new drug that proved to have a large market demand, and the team that developed the drug was assigned to build a new manufacturing facility to produce the drug. The project manager for the construction company that was awarded the contract to build the manufacturing facility managed the project effectively. Every request for a change in scope was approved, and the result was a 20 percent increase
to the total cost of the project. On most projects, a 20 percent increase in the project cost would be considered poor performance. For the client’s project team, who were accustomed to complex projects with a large number of unknown issues that increase the final cost of the project, a 20 percent overrun in cost was not unusual. Even though the project was 20 percent over budget, the client was happy. Client satisfaction is often tied to expectations about project performance. Identifying and managing those expectations is a primary responsibility of the project manager.

Discussion

What are the differences between the two projects? Identify the single most important difference between the two projects that affected client satisfaction. Suggest an approach to managing client expectations in the highway project that might have resulted in meeting or exceeding expectations rather than disappointment.

In: Computer Science

I am coding with NetBeans LDE Java. Write a program that reads a positive integer n...

I am coding with NetBeans LDE Java.

Write a program that reads a positive integer n , prints all sums from 1 to any integer m 1≤mn . For example, if n=100, the output of your program should be

The sum of positive integers from 1 to 1 is 1;

      The sum of positive integers from 1 to 2 is 3;

      The sum of positive integers from 1 to 3 is 6;

      The sum of positive integers from 1 to 4 is 10;

      The sum of positive integers from 1 to 5 is 15;

*

*

*

*

      The sum of positive integers from 1 to 100 is 5050.

(The program should include a main method, and no tester class is needed)

In: Computer Science

Convert the following hexadecimal representations of 16-bit 2’s complement binary numbers to decimal. a.FCAD b.DEAD c.1111...

Convert the following hexadecimal representations of 16-bit 2’s complement binary numbers to decimal.

a.FCAD

b.DEAD

c.1111

d.8000

e.FACE

In: Computer Science

write a program in C language Create a function to perform the insertion sort. Now the...

write a program in C language

Create a function to perform the insertion sort. Now the program will perform the following steps:

  1. Prompt the user to enter the number of array elements (say, N).
  2. Read the number of elements (N).
  3. Use dynamic memory allocation to allocate an array of N single precision floating-point elements (C type float).
  4. Read the N single precision floating-points elements to the allocated array.
  5. Invoke a function to sort the array using insertion sort (the insertion sort function should take the array reference and number of elements as the arguments and sort the array in-place). The insertion sort function should have the return type as void, i.e., it does not return anything.
  6. Print the sorted array.

Code snippet:

1. Function Declaration

void displayArray(float *arr, int size); 
void sortArray(float *arr, int size); 

2. Function definition

void displayArray(float *arr, int size){ 
    printf("["); 
    for (int i=0; i<size-1; i++) { 
            printf("%f, ",arr[i]); 
    } 
    printf("%f]\n", arr[size-1]);      
} 

3. Function call/invocation

displayArray(arr, N); 
sortArray(arr, N); 

4. Dynamic memory allocation for array

float *arr = (float*) malloc(N * sizeof(float)); 

In: Computer Science