Questions
Create a python program that will ask the user for his job title and print out...

Create a python program that will ask the user for his job title and print out the first letter, the last letter and the total number of letters in his job

In: Computer Science

I used this code for my first draft assignment. My teacher told me not to add...

I used this code for my first draft assignment. My teacher told me not to add a decrypt function. I have the variable encryptionKey holding 16. I can simply negate encryptionKey with the - in front. Then I make one key change and all the code still works properly. How do I adjust this code?

import csv import sys #The password list - We start with it populated for testing purposes passwords = [["yahoo","XqffoZeo"],["google","CoIushujSetu"]] #The password file name to store the passwords to passwordFileName = "samplePasswordFile" #The encryption key for the caesar cypher encryptionKey=16 #Caesar Cypher Encryption def passwordEncrypt (unencryptedMessage, key): # We will start with an empty string as our encryptedMessage encryptedMessage = '' # For each symbol in the unencryptedMessage we will add an encrypted symbol into the encryptedMessage for symbol in unencryptedMessage: if symbol.isalpha(): num = ord(symbol) num += key if symbol.isupper(): if num > ord('Z'): num -= 26 elif num < ord('A'): num += 26 elif symbol.islower(): if num > ord('z'): num -= 26 elif num < ord('a'): num += 26 encryptedMessage += chr(num) else: encryptedMessage += symbol return encryptedMessage #Caesar Cypher Decryption def passwordDecrypt (encryptedMessage, key): # We will start with an empty string as our unencryptedMessage unEncryptedMessage = '' # For each symbol in the encryptedMessage we will add an unencrypted symbol into the unencryptedMessage for symbol in encryptedMessage: if symbol.isalpha(): num = ord(symbol) num -= key if symbol.isupper(): if num > ord('Z'): num -= 26 elif num < ord('A'): num += 26 elif symbol.islower(): if num > ord('z'): num -= 26 elif num < ord('a'): num += 26 unEncryptedMessage += chr(num) else: unEncryptedMessage += symbol return unEncryptedMessage def loadPasswordFile(fileName): with open(fileName, newline='') as csvfile: passwordreader = csv.reader(csvfile) passwordList = list(passwordreader) return passwordList def savePasswordFile(passwordList, fileName): with open(fileName, 'w+', newline='') as csvfile: passwordwriter = csv.writer(csvfile) passwordwriter.writerows(passwordList) while True: print("What would you like to do:") print(" 1. Open password file") print(" 2. Lookup a password") print(" 3. Add a password") print(" 4. Save password file") print(" 5. Print the encrypted password list (for testing)") print(" 6. Quit program") print("Please enter a number (1-4)") choice = input() if (choice == '1'): # Load the password list from a file passwords = loadPasswordFile(passwordFileName) if (choice == '2'): # Lookup at password print("Which website do you want to lookup the password for?") for keyvalue in passwords: print(keyvalue[0]) passwordToLookup = input() # Iterate through password list # Match it with user input # If matches, save password in a variable and break from loop # Print password # Decrypt password and print it as well for i in range(len(passwords)): if passwords[i][0]==passwordToLookup: pwd=passwords[i][1] break print(pwd) decryptedPassword=passwordDecrypt(pwd,encryptionKey) print(decryptedPassword) if (choice == '3'): print("What website is this password for?") website = input() print("What is the password?") unencryptedPassword = input() # Encrypt entered password # Create a list with website name and passsword # Add this to existing passwords list encryptedPassword = passwordEncrypt(unencryptedPassword, encryptionKey) pwdList=[website,encryptedPassword] passwords.append(pwdList) if (choice == '4'): # Save the passwords to a file savePasswordFile(passwords, passwordFileName) if (choice == '5'): # print out the password list for keyvalue in passwords: print(', '.join(keyvalue)) if (choice == '6'): # quit our program sys.exit()

In: Computer Science

The Classic Triangle Testing Problem, (Myer's Triangle): A program reads three integer values. The three values...

The Classic Triangle Testing Problem, (Myer's Triangle): A program reads three integer values. The three values are interpreted as representing the lengths of the sides of a triangle. The program prints a message that states whether the triangle is scalene, isosceles, or equilateral. Develop a set of test cases (at least 6 ) that you feel will adequately test this program. (This is a classic testing problem and you could find numerous explanations about it on the internet. I would recommend that you try to submit your own answer, based on your understanding of the topic)

Please answer as soon as possible. I have no time.

Software Engineering 1.

In: Computer Science

I want to scan in 4 ints and the next 3 lines into an array of...

I want to scan in 4 ints and the next 3 lines into an array of a text file in java.

Ex

1 2 3

adacdac

acddddd

acdadcd

1,2,3 would be stored into seperate int values and the next 3 strings would be stored into an array

In: Computer Science

Draw the MySQL Data Model Maria’s Pizza – a local pizza shop that provides pizzas for...

Draw the MySQL Data Model

Maria’s Pizza – a local pizza shop that provides pizzas for pickup with one location - has hired you to create a database for them to store information about the store and its operations. Prior to building the database, you have decided to present the data model to the client for her approval. Here are the set of requirements that you have for the data model.

The client would like you to track the employees that they have in their store and the shift that is worked by the employees. They need to keep track of personal information about the employee including their name, phone number, address, social security number and other relevant information. This information does change from time to time as employees occasionally move. The store maintains two shifts, mid-day (11 AM – 5 PM) and night (5:00 PM to 11:00 PM). Employees can work across multiple shifts and shifts have multiple employees that work in that period. Shifts also have an employee as a supervisor. Therefore, different employees have different shift supervisors depending on which shift they are working – an employee in one shift may be the shift supervisor in another shift during the week.

Maria’s Pizza would also like this database to tie into their inventory system of food products that they offer. They sell only pizza for pickup, so the ingredients are what they need to keep track of – and all ingredients are tracked by packages of certain ounces (for example flour comes in 400 oz packages, mushrooms come in 64 oz packages, mozzarella cheese comes in 128 oz packages). They need to know the purchase price for each package, and the date of receipt of each shipment, and they update the quantity on hand every night before closing.

Maria’s Pizza has a single food distributor as its main supplier, but will buy a few items like sausage and fresh tomatoes from other local sources. After conducting inventory every night, they send orders if inventory levels get below certain thresholds. They would like to track the reordering of the different products from the suppliers including the date the re-order was placed, the employee that placed the order, and the scheduled delivery date of that order. Products can get re-ordered multiple times and employees can place multiple orders for products. Supplier information is also to be stored in the database including the supplier’s contact information, name and address. Because the same product can get ordered from multiple suppliers, it is important that the reorder contain information about which supplier that re-order was placed with.

Draw a data model for the above scenario.

In: Computer Science

Write a MIPS assembly program that reads 3 add them together and stores the answer in...

Write a MIPS assembly program that reads 3 add them together and stores the answer in memory.

In: Computer Science

Write a small section of Python code that defines a function called check_even(value) - the function...

Write a small section of Python code that defines a function called check_even(value) - the function takes a numerical value as input and returns True or False based on whether the provided argument is divisible by 2 (i.e. is it odd or is it even). If the argument provided is not a number (as determined by built-in the isdigit() function - which only works on string data) then rather than crashing, the function should raise an exception which is caught outside the function (i.e. in the block of code calling the function). Provide three calls to the function: - One with an even value where the function should return True, - Another with an odd value where the function should return False, and - One with non-numerical data which should raise an exception that will be caught and displayed in the block of code that calls the function.

In: Computer Science

Write a C program that calculates the average grade for a specified number of students from...

  1. Write a C program that calculates the average grade for a specified number of students from each student's termtest and final grade. The program must first ask the user how many students there are. Then, for each student, the program will ask the user for the termtest grade (grade #1) and final grade (grade #2). The program should be able to handle up to 100 students, each with 2 grades (termtest and final). Use a two dimensional float array to store the grades. Then, using a loop, prompt the user for the termtest and final grade of each student. Create a second single-dimensional float array to hold the average grade for each student (for up to 100 students). To calculate the average grade, pass both the two dimensional array and the single dimensional array to a function named void calculateAverages(float grades[][2], float averages[], int numStudents). The third parameter of the function indicates the actual number of students. The function will then use a loop to calculate the average grade for each student. Remember, since averages is an array parameter, any changes to averages is changing the original array. When the function returns to main, the program (in main) should display the average grade for each student (using a loop).

    Example output:
    How many students are there? 3
    Please enter grade #1 for student #1: 80
    Please enter grade #2 for student #1: 60
    Please enter grade #1 for student #2: 90
    Please enter grade #2 for student #2: 60
    Please enter grade #1 for student #3: 70
    Please enter grade #2 for student #3: 74
    The average grade for student #1 is 70
    The average grade for student #2 is 75
    The average grade for student #3 is 72

In: Computer Science

What are the major phases of the software lifecycle? Give a short description of each.

What are the major phases of the software lifecycle? Give a short description of each.

In: Computer Science

What is coupling and cohesion? What is their relationship to software engineering?

What is coupling and cohesion? What is their relationship to software engineering?

In: Computer Science

In C++ create a simple larger3( ) function that takes 3 positive numbers as parameters and...

In C++ create a simple larger3( ) function that takes 3 positive numbers as parameters and returns the largest value of the three numbers.

In: Computer Science

in java language Write a method called findNums that takes a two-dimension array of integers and...

in java language

Write a method called findNums that takes a two-dimension array of integers and an int as parameters and returns the number of times the integer parameter appears in the array. For example, if the array (as created by the program below) is

10 45 3 8

2 42

3 21 44

And the integer parameter is 3, the value returned would be 2 (the number 3 appears two times in the array)

public class Question2 {

   public static void main(String args[]){

     int arr[][] = {{10, 45, 3, 8}, {2, 42}, {3, 21, 44}};

     System.out.println(“The number time 3 appears is “+findNums(arr,3));

   } //main

In: Computer Science

write a program to calculate and print payslips write program that calculates and prints payslips. User...

write a program to calculate and print payslips

write program that calculates and prints payslips. User inputs are the name of employee, numbers of hours worked and hourly rate

c++ language

In: Computer Science

<!DOCTYPE html> <html> <body> <script> // // The colors red, blue, and yellow are known as...

<!DOCTYPE html>
<html>
<body>
<script>
//
// The colors red, blue, and yellow are known as the primary colors because they
// cannot be made by mixing other colors. When you mix two primary colors, you
// get a secondary color, as shown here:
//
//              When you mix red and blue, you get purple.
//              When you mix red and yellow, you get orange.
//              When you mix blue and yellow, you get green.
//
// Design a program that prompts the user to enter the names of two primary colors
// to mix. If the user enters anything other than “red,” “blue,” or “yellow,” the
// program should display an error message. Otherwise, the program should display
// the name of the secondary color that results.
//

function findSecondaryColor(color1, color2) {

/////////////////////////////////////////////////////////////////////////////////
// Insert your code between here and the next comment block.  Do not alter     //
// any code in any other part of this file.                                    //
/////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////
// Insert your code between here and the previous comment block.  Do not alter //
// any code in any other part of this file.                                    //
/////////////////////////////////////////////////////////////////////////////////

}

var color1 = prompt("What is the first primary color you'd like to mix? (red, blue or yellow) ");
var color2 = prompt("What is the first second color you'd like to mix? (red, blue or yellow) ");

alert(findSecondaryColor(color1, color2));

</script>
</body>
</html>

In: Computer Science

Part (a) CREATE TWO TABLES IN MICROSOFT ACCESS: (1) A Customer Table which includes the following...

Part (a) CREATE TWO TABLES IN MICROSOFT ACCESS: (1) A Customer Table which includes the following fields: Customer Name, Customer Address, and Credit Limit. (Note: All customers have a $40,000 credit limit). (2) A Sales Invoice table which includes the following fields: Customer Name, Salesperson, Date of Sale, Invoice Number, Amount of Sale. Part (b): Run the following queries: Query 1: List all sales between 10/20/2014 and 11/20/2014 that were greater than $2,500. Include in your query the customer name, date of sale, invoice number, and amount of sale. List the sales in alphabetical order by customer name. Query 2: List total sales by each salesperson for October and November 2014 in descending order. Include in your query the salesperson name and amount of total sales. Query 3: List the total sales by customer in descending order. Include in your query the customer name, customer address, and amount of total sales per customer. Query 4: List the remaining credit available for each customer. Include in your query the customer name, customer address, credit limit, amount of total sales per customer, and remaining credit available for each customer in descending order of remaining credit available.

In: Computer Science