Questions
Python file def calci(): grade = float(input("Enter your grade:")) while (grade <= 4): if (grade >=...

Python file

def calci(): grade = float(input("Enter your grade:")) while (grade <= 4): if (grade >= 0.00 and grade <= 0.67): print("F") break elif (grade >= 0.67 and grade <= 0.99): print("D-") break elif (grade >= 1.00 and grade <= 1.32): print("D") break elif (grade >= 1.33 and grade <= 1.66): print("D+") break elif (grade >= 1.67 and grade <= 1.99): print("C-") break elif (grade >= 2.00 and grade <= 2.32): print("C") break elif (grade >= 2.33 and grade <= 2.66): print("C+") break elif (grade >= 2.67 and grade <= 2.99): print("B-") break elif (grade >= 3.00 and grade <= 3.32): print("B") break elif (grade >= 3.33 and grade <= 3.66): print("B+") elif (grade >= 3.67 and grade <= 3.99): print("A-") break elif (grade == 4.00): print("A") break elif (grade == 4.00): print("A+") else: print("Invalid input enter FLOAT only") def main2(): question = input("Continue (y/n)") if question == "y" or question == "Y": calci() if question == "n" or question == "N": print("Bye") print("ISQA 4900 quiz") main2() TWO PROBLEM1)it need to ask question everytime 2) it should show an invalid message

In: Computer Science

I need to create a monthly loan Calculator in C++. I know the formula but can't...

I need to create a monthly loan Calculator in C++. I know the formula but can't figure out what's wrong with my code. Any clarification would be appreciated!


// Only add code where indicated by the comments.
// Do not modify any other code.
#include <iostream>
#include <cmath>
using namespace std;

int main() {
   // ---------------- Add code here --------------------
   // -- Declare necessary variables here              --
  
    int years = 0; //n
    int LoanAmount = 0;
    double AnnualRate = 0.0; //r
    double payment = 0.0;
  
    // --
    cout << "Enter the amount, rate as a percentage (e.g. 3.25), and number of years\n";
    cout << " separated by spaces: " << endl;

   // ---------------- Add code here --------------------
   // -- Receive input and compute the monthly payment --
   cin >> LoanAmount >> AnnualRate >> years;

   AnnualRate = AnnualRate / 100;
   years = years * 12;

   payment = ((LoanAmount * AnnualRate) / 1 - (1 + AnnualRate) * -years);
  
   // ---------------- Add code here ------------------
    // Print out the answer as a double, all by itself
    // (no text) followed by a newline
    // Ex. cout << payment << endl;

   cout << payment << endl;

  
    return 0;
}

In: Computer Science

Develop a C program for matrix multiplication focusing on using malloc and pointers WITHOUT USING BRACKETS...

Develop a C program for matrix multiplication focusing on using malloc and pointers WITHOUT USING BRACKETS [] !!

* DO not use [ ] 'brackets', focus on using malloc, calloc, etc...

Program will ask user for the name of the text file to be read
Read the datafile with format:
1
2
1
1 2
3
4
So the first three lines will represent m, n, p (Matrix A: m x n ||| Matrix B: n x p), follwing are the two matrices.
Representing:
A = |1 2|     B = |3|
                         |4|

------------------------------------------------
example input and output:
Matrix A contents:
    1    2
    3    4
    5    6

Matrix B contents:
    7    8    9   10
   11   12   13   14

Matrix A * B is:
   29   32   35   38
   65   72   79   86
101 112 123 134

The datafile read for this example is:
3
2
4
1 2
3 4
5 6
7 8 9 10
11 12 13 14

In: Computer Science

Specification This script reads in class data from a file and creates a dictionary. It then...

Specification

This script reads in class data from a file and creates a dictionary.

It then prints the data from the dictionary.

The script has the following functions

  • class_tuple_create
  • print_classes

class_tuple_create

This function has the following header

def class_tuple_create(filename):

The function reads in a file with four fields of data about a class.

The fields are

        
Course ID       Room number     Instructor      Start time

The function must print an error message if the file cannot be opened for any reason.

The function should read in each line of the file and split it into a list of 4 elements.

It should add the information in the line into a dictionary, where the key is the course number and the value is a tuple consisting of the room number, the instructor and the start time.

The function should return this dictionary when it has read all the lines in the file.

print_classes

This function has the following header

def print_classes(class_info):

It should print the following table header

ID      Room            Instr   Start

Then it should print out the data for each class in alphabetical order by Class ID.

The data for each course should align with the labels.

Test Code

The script must contain the following test code at the bottom of the file

class_information = class_tuple_create('xxxxx')
class_information = class_tuple_create('courses.txt')
print_classes(class_information)

For the test code to work you must copy into your hw3 directory the file from /home/ghoffman/course_files/it117_files.

cp  /home/ghoffman/course_files/it117_files/courses.txt  .

Suggestions

Write this script in stages, testing your script at each step

  1. Create the file hw3.py and copy the function header for class_tuple_create into it.
    For the body of this function enter pass. Copy the function header for print_classes into the script.
    Again use pass as the function body.
    Copy the test code above into the script.
    Make the script executable and run it.
    You should see nothing.
    If you get an error message, fix the problem before proceeding.
  2. Remove the pass statement in class_tuple_create.
    Create a file object so you can read the file given as a parameter.
    Write an error message if the file cannot be opened.
    Run the script.
    You should see one error message.
  3. Using a for loop print each line of the file.
    Run the script and fix any errors.
  4. Remove the print statement you just created.
    In it's place use the split string method to create a list of words in the line.
    Print the list of words.
    Run the script and fix any errors.
  5. Remove the print statement you just created.
    Define the variable course_id and set its value to the first element of the list.
    Print the value of this variable.
    Run the script and fix any errors.
  6. Create the variable class_data and set its value to a tuple consisting of the remaining fields in the list.
    You might want to use a slice to do this and tuple conversion function to do this.
    Print course_id and class_data.
    Run the script and fix any errors.
  7. Create an empty dictionary at the top of the function.
    Inside the for loop add an entry to the dictionary where the key is the class ID and the value is the tuple.
    Outside the loop but still inside the function, print this dictionary.
    Run the script and fix any errors.
  8. Remove all print statements from class_tuple_create.
    Have the function return the dictionary you just created.
    Remove the pass statement from print_classes and replace it with a statement that prints the parameter.
    Run the script and fix any errors.
  9. Using a for loop, print the class IDs in sorted alphabetical order.
    Run the script and fix any errors.
  10. Inside the loop use the create the variable course_data and assign it the tuple associated with each class ID.
    Print the class ID and tuple for each class.
    Run the script and fix any errors.
  11. Change the print statement so that it prints the class ID and each element of the tuple with a Tab between each value.
    Run the script and fix any errors.
  12. Print the labels for each column and a line of dashes underneath it.

Output

The output should look something like this

Error: Unable to open xxxxx
ID  Room    Instr   Start
-------------------------------
CM241   1411    Lee 13:00
CS101   3004    Haynes  8:00
CS102   4501    Smith   9:00
CS103   6755    Rich    10:00
NT110   1244    Burke   11:00

In: Computer Science

Implement an infix expression to postfix expression convertor in C++. Note: - Support +, -, *,...

Implement an infix expression to postfix expression convertor in C++.

Note: - Support +, -, *, /, ( and ) in infix expressions.

- Operands will be nonnegative only.

- Assume infix expressions are valid and well formatted (one blank space to separate operand/operator)

For example,

- 3 * 4 + 5 ➔ 3 4 * 5 +

- 3 + 4 * 5 ➔ 3 4 5 * +

- (3 + 4) * (5 + 6) ➔ 3 4 + 5 6 + *

In: Computer Science

Write a C# console program that continually asks the user "Do you want to enter a...

Write a C# console program that continually asks the user "Do you want to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and then get keyboard input of the name. After entering the name, display the name to the screen.

In: Computer Science

Describe how cloud computing may lead to “intelligent fabrics” in the future and how this will...

Describe how cloud computing may lead to “intelligent fabrics” in the future and how this will impact companies and consumers. Use real-world examples to support your assertions.

In: Computer Science

Write a C# console program that continually asks the user "Do you want to enter a...

Write a C# console program that continually asks the user "Do you want to enter a name (Y/N)? ". Use a "while" loop to accomplish this. As long as the user enters either an upper or lowercase 'Y', then prompt to the screen "Enter First and Last Name: " and then get keyboard input of the name. After entering the name, display the name to the screen.

In: Computer Science

Linux Fundamentals part 4 final Below are questions related to the command line use of Linux....

Linux Fundamentals part 4 final

Below are questions related to the command line use of Linux.  You can use the videos, man pages, and notes to answer these questions. 

Remember that Linux is CASE SENSITIVE.  Rm and rm are NOT the same command.  I will count off totally for a question if you do not take this into account.

For each command give me the ENTIRE COMMAND SEQUENCE.  If I ask you  'What command would I use to move the file one.txt to the parent directory and rename it to two.txt?", the answer is NOT 'mv'. That is only part of the command. I want the entire command sequence.

16. Find all files under ~ whose content contain the keyword taco OR Taco OR taCo OR tacO. NOT all variations in case for 'taco', but just the variations listed meaning a keyword of tAco, tACO, tACo, etc, will not produce a result.


17. Find all files under the current directory which ends in '.txt' (just the .txt not the single quotes) and use -exec to create a listing of each files inode number. Since we're using -exec, this means we will call another command to produce the inode based on the results found. What command do we use to make listings? Now you just need to find how to make it produce an inode result. To the man page!


18. What command would I run to update the database of file names used by the locate command?


19. Find all files under the /var directory with a size less than 1 kilobyte. Use -exec and an appropriate command to copy those files to ~/Documents/FallFun/sep.


20. Find all files under the ~ directory that are named 'Picard' ignoring case.

In: Computer Science

Prove that the following language are NOT regular using the pumping lemma (20 pt.) ? =...

Prove that the following language are NOT regular using the pumping lemma

  1. (20 pt.) ? = {? ∈ {?, #}∗ | ? = ??#??# ... #?? ??? ? ≥ ?, ?? ∈ ?∗ ??? ????? ?, ??? ?? ≠?? ???????? ?≠?}
    Hint: choose a string ? ∈ ? that contains ? #’s.

In: Computer Science

implement Max Subarray Problem via Divide-and-conquer off this code #include <iostream> #define MAX_INT 2147483647 using namespace...

implement Max Subarray Problem via Divide-and-conquer off this code

#include <iostream>
#define MAX_INT 2147483647
using namespace std;

int main(int argc,char **argv) {

int* array;
int arraySize = 1;


// Get the size of the sequence
cin >> arraySize;
array = new int[arraySize];

// Read the sequence
for(int i=0; i<arraySize; i++){

cin >> array[i];

}

In: Computer Science

Configuring Windows Firewall In this project, you edit configuration settings on Windows Firewall. Note Windows Firewall...

Configuring Windows Firewall

In this project, you edit configuration settings on Windows Firewall.

Note

Windows Firewall uses three different profiles: domain (when the computer is connected to a Windows domain), private (when connected to a private network, such as a work or home network), and public (used when connected to a public network, such as a public Wi-Fi). A computer may use multiple profiles, so that a business laptop computer may use the domain profile at work, the private profile when connected to the home network, and the public profile when connected to a public Wi-Fi network. Windows asks whether a network is public or private when you first connect to it.

  1. 1

    Click Start, click the search icon, and enter Firewall.

  2. 2

    Click Windows Firewall Control panel.

  3. 3

    Click Turn Windows Firewall on or off. Be sure that the Windows Firewall is turned on for both private and public networks.

  4. 4

    Under Public network settings check Block all incoming connections, including those in the list of allowed apps. This provides an extra level of security when using a public network such as a free Wi-Fi network by preventing a malicious incoming connection from another computer on the network. Click OK.

  5. 5

    To allow an inbound connection from an installed application, in the left pane click Allow an app or feature through Windows Firewall.

  6. 6

    Each program or feature of Windows can be chosen to allow an incoming connection on public or private networks. Click Allow another app.

  7. 7

    From here you can select an app that will permit an incoming connection. Because this is a security risk, click Cancel and then OK.

  8. 8

    Now check the configuration properties of Windows Firewall. Click Advanced settings.

  9. 9

    Click Properties in the right pane.

  10. 10

    Note the settings on each of the profiles by clicking the Domain Profile, Private Profile, and Public Profile tabs. Is there any difference in the settings between these profiles? Why?

  11. 11

    On each tab under Settings, click Customize. Be sure that Display a notification is set to Yes. Why would this be important?

  12. 12

    Click OK to return to the Windows Firewall with Advanced Security page.

  13. 13

    In addition to being application-aware, Windows Firewall also can be configured for firewall rules. Click Outbound Rules in the left pane to block a program from reaching the Internet.

  14. 14

    In the right pane, click New Rule.

  15. 15

    Click Port and then click Next.

    Note

    In addition to ports, the Windows Firewall also can block by program (Program) or even by program, port, and IP address (Custom).

  16. 16

    If necessary, click TCP.

  17. 17

    Next to Specific remote ports: enter 80. Click Next.

  18. 18

    If necessary, click Block the connection. Click Next.

  19. 19

    Be sure that this new rule applies to all three domains. Click Next.

  20. 20

    Under Name: enter Blocking Port 80. Click Finish.

  21. 21

    Now open a web browser and try to connect to the Internet. What happens?

  22. 22

    Click the Back button to return to the Windows Firewall screen and click Action and Restore Default Policy to disable this rule. If a warning dialog box appears, click Yes. Click OK.

  23. 23

    Select Outbound Rules in the left pane. In the right pane, click New Rule.

  24. 24

    Click Custom and Next.

  25. 25

    If necessary, click All programs and Next.

  26. 26

    Note that you can configure a firewall rule based on protocol, protocol number, local port, and remote port.

  27. 27

    Click Cancel.

  28. 28

    Close all windows.

  29. please answer all the questions, and take screenshots of all the steps

In: Computer Science

What is printed? public static void main(String[] args) { int i = 6; aMeth(i); System.out.print(i); }...

What is printed?

public static void main(String[] args)
{
int i = 6;
aMeth(i);
System.out.print(i);
}
public static void aMeth(int i) 
{
System.out.print(i);
i = i + 1;
System.out.print(i);
}

2)

What is printed as the value of b?

 Scanner kybd = new Scanner(System.in);
 System.out.println("Enter two ints " );
 int i = kybd.nextInt();
 int j = kybd.nextInt();
 boolean b = ((i % 2) == 0) && ((j % 2) == 0);
 System.out.println(b);

3)

In: Computer Science

Generating a sequence using Pthreads Having multiple threads call a function, like will have a non-deterministic...

Generating a sequence using Pthreads

Having multiple threads call a function, like will have a non-deterministic execution. Write a program with 3 threads that call a function called do_work. Each thread will be responsible for generating a number and appending it to a buffer. Thread 1 generates number 1, thread 2 generates number 2, and thread 3 generates number 3. These numbers assigned to the threads are passed in as arguments. Each thread will store its value in a shared buffer of integers having a size of 3 elements called “buffer”. When the third element is added to the buffer by either thread 1, 2 or 3, then it checks to see if the sequence is “123”. If not, it clears the buffer and the threads try to generate the sequence again. Once the total number of sequences of “123” reach 10, the threads print out the total number of tries it took to print “123”. For example, keep track of the total number of other sequences generated (includi it should print out it’s corresponding number. Below is example output at the end of the program’s execution. Ensure that your program produces the exact same output formatting; you will see why in a moment. ...

My id: 2

My id: 1

Total ses geneted: 38

Number of cect sequences: 10

Testing:

You will test that your program appears to work correctly. I provide you with a python script that tests the output of your program: A3sequence_test.py. After you believe your pr document it as well, with screenshots and a text description. For instance “my program never stops running and it should stop because the counter value is 10 and therefore...”.

In: Computer Science

1) Consider an automated teller machine (ATM) in which users provide a personal identification number (PIN)....

1) Consider an automated teller machine (ATM) in which users provide a personal identification number (PIN). Discuss what confidentiality, integrity, availability, authenticity, and non-repudiation refer to in this type of service.
2) Discuss how design principles of abstraction, modularity, and layering help with security.

In: Computer Science