Questions
Hello! I'm trying to work on a python lab in my class, and we basically have...

Hello! I'm trying to work on a python lab in my class, and we basically have to make this method

play_interactive

Now for the fun bit. The function play_interactive will take just one argument --- the length of patterns to use as keys in the dictionary --- and will start an interactive game session, reading either '1' or '2' from the player as guesses, using the functions you wrote above and producing output as shown in the sample game session at the beginning of this writeup. If the player types in any other input (besides '1' or '2'), the game should terminate.

Hint: the input function can be used to read input from the user as a string.

My code so far looks like this, I have the basic loop down and working, but my guesses list to retain the guesses for this method isn't updating

def play_interactive(pattern_length=4):
while True:
x = input()
intX = int(x)
guesses = ([])
if(intX == 1 or intX == 2):
guesses.append(intX)
print(len(guesses))
else:
print("Finished")
break

Any help would be appreciated! Thank you so much

In: Computer Science

using C program Assignment Write a computer program that converts a time provided in hours, minutes,...

using C program

Assignment

Write a computer program that converts a time provided in hours, minutes, and seconds to seconds

Functional requirements

  1. Input MUST be specified in hours, minutes, and seconds
  2. MUST produce the same output as listed below in the sample run
  3. MUST correctly compute times

Nonfunctional requirements

  1. MUST adhere to program template include below
  2. MUST compile without warnings and errors
  3. MUST follow the code template provided in this assignment
  4. MUST NOT change " int main() " function
  5. MUST only edit sections marked by " // complete this "

Sample run

4 hours, 13 minutes and 20 seconds is equal to 15200 seconds.
8 hours, 0 minutes and 0 seconds is equal to 28800 seconds.
1 hours, 30 minutes and 0 seconds is equal to 5400 seconds.

Grading

This assignment will be graded according to the programming grading rubric.

Due date

The assignment is due by the 11:59pm on September 20, 2019.

Requested files

time_to_sec.c

/*

* time_to_sec.c

*

* Created on: Jul 20, 2016

* Author: leune

*/

// appropriate #include statements

/* Convert a time interval specified in hours, minutes and seconds to

* seconds.

* Parameters:

* hours, minutes, seconds: input time elements

* Preconditions:

* 0 <= minutes < 60

* 0 <= seconds < 60

* Return:

* number of seconds in the interval

*/

unsigned int time_to_sec(unsigned int hours, unsigned int minutes,

unsigned int seconds) {

// complete this

}

/* Print a formatted representation of the calculation

* Parameters:

* hours, minutes, seconds: input time elements

* Postcondition:

* Function will write the calculation to standard output.

*/

void format_seconds(unsigned int hours, unsigned int minutes,

unsigned int seconds) {

// complete this

}

int main(void) {

format_seconds(4, 13, 20);

format_seconds(8, 0, 0);

format_seconds(1, 30, 0);

}

In: Computer Science

Create a 1- to 2-page IRP Microsoft Word for an IT organization. In your plan, ensure...

Create a 1- to 2-page IRP Microsoft Word for an IT organization. In your plan, ensure you:

  • Discuss roles and responsibilities.
  • Discuss the critical activities for each of the 5 phases in the incident response process.
  • List at least 3 cyber security tools that work together to monitor the organization’s network for malicious and abnormal activity.

In: Computer Science

C++ Given two finite sets, list all elements in the Cartesian product of these two sets.

C++

Given two finite sets, list all elements in the Cartesian product of these two sets.

In: Computer Science

Computer Science (C and Assembly Languages)    •   Assume there are two 32-bit variables in RAM...

Computer Science (C and Assembly Languages)

   •   Assume there are two 32-bit variables in RAM memory called In and Out. Write C code that sets Out equal to In plus 2.

   •   Assume there are two 32-bit variables in RAM memory called In and Out. Write assembly code that sets Out equal to In plus 2.


   •   What are the three stack rules?

   •   Assume B1 is a 32-bit unsigned global variable. We wish to write code that decrements B1 with the exception that it will not decrement if B1 is already 0. Draw a flowchart of the process. Write the code in both C and assembly.


   •   Assume G1 is a 32-bit unsigned global variable. We wish to write code that increments G1 if G1 is less than 20. Draw a flowchart of the process. Write the code in both C and assembly.

   •   Develop the pseudocode and the flowchart for a program that finds the sum of 5 numbers.


   •   Comment each line of the ARM Assembly language to explain what the code does. [4 pts]
start
MOV r0, #15
MOV r1, #8
ADD r0, r0, r1
MOV r4, #0x300

   •   Comment each line of the C language to explain what the code does. [4 pts]
#include <stdio.h>
int main()
{
int number;
printf("Enter an integer: ");
scanf("%d", &number);

if (number < 0)
{
printf("You entered %d.\n", number);
}

printf("The if statement is easy.");

return 0;
}

In: Computer Science

Python Albert Einstein famously said that compound interest is the 8th wonder of the world. Hopefully,...

Python

Albert Einstein famously said that compound interest is the 8th wonder of the world. Hopefully, all of you have had a finance course to teach you why it is so much more powerful than simple interest, which we programmed in class. If you are unfamiliar with compound interest, google it (note - if you google "compound interest for dummies" you will get a MUCH simpler explanation of how it works, without greek function notations!!)

Your assignment this week is to use a for loop, with the range() function to figure out compound interest on a deposit. You will ask the user for the amount of the deposit, the interest rate and the number of years and tell her how much money she has after that amount of time. Be sure to use the isnumeric function, and do NOT use an exponent to figure out compound interest - use a loop!

In: Computer Science

Q4: Write a program that takes as input two opposite corners of a rectangle: (x1,y1) and...

Q4: Write a program that takes as input two opposite corners of a rectangle: (x1,y1) and (x2,y2). Finally, the user is prompted for the coordinates of a third point (x,y). The program should print Boolean value True or False based on whether the point (x,y) lies inside the rectangle. If the point lies on the rectangle, the program should print False.

Program should work irrespective of the order in which the user inputs the opposite coordinates. program user should be able to input coordinates in all possible orders.

- Right upper coordinate first and then left lower coordinate

- Left lower coordinate first and then right upper coordinate

- Left upper coordinate first and then right lower coordinate

- Right lower coordinate first and then left upper coordinate

In: Computer Science

I need to update this java program to take input about each employee from a file...

I need to update this java program to take input about each employee from a file and write their information and salary/pay information to a file. use input file

payroll.txt

Kevin

Yang

60

20

Trey

Adams

30

15

Rick

Johnson

45

10

Cynthia

Wheeler

55

11.50

Sarah

Davis

24

10

Muhammad

Rabish

66

12

Dale

Allen

11

18

Andrew

Jimenez

80

15

import java.util.Scanner;
public class SalaryCalcLoop
{
double Rpay = 0, Opay = 0;
void calPay(double hours, double rate) {
if (hours <= 40)
{
Rpay = hours * rate;
Opay = 0;
}
else
{
double Rhr, Ohr;
Rhr = 40;
Ohr = hours - Rhr;
Rpay = Rhr * rate;
Opay = Ohr * (1.5 * rate);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name;
int shift = 0;
Double rate, hours;
System.out.println("Pay Calculator");
String ch = "";
do
{
System.out.println("Enter Your Name");
name = sc.next();
System.out.println("Enter Your Shift, Enter 0 for Day, Enterv1 for Night");
System.out.println("0=Day, 1= Night");
shift=sc.nextInt();
System.out.println("Enter Number of Hours Worked");
hours = sc.nextDouble();
System.out.println("Enter Hourly Pay");
rate = sc.nextDouble();
SalaryCalc c = new SalaryCalc();
c.calPay(hours, rate);
Double Tpay = c.Rpay + c.Opay;
System.out.println();
System.out.println("Calculate Pay");
System.out.println("Employee Name: " + name);
System.out.println("Employee Regular Pay: " + c.Rpay);
System.out.println("Employee Overtime Pay: " + c.Opay);
System.out.println("Employee Total Pay: " + Tpay);
if (shift == 0)
{
System.out.println("Employee PayPeriod is Friday");
}
else
{
System.out.println("Employee PayPeriod is Saturday");
}
System.out.println("Press Y to continue. Press any other key to exit ");
ch=sc.next();
}
while(ch.equalsIgnoreCase("y"));
}
}

Saturday"); } System.out.println("Press Y to continue. Press any other key to exit "); ch=sc.next(); } while(ch.equalsIgnoreCase("y")); } }

In: Computer Science

Write a class encapsulating the concept of a Student Employee, assuming that a student has the...

Write a class encapsulating the concept of a Student Employee, assuming that a student has the following attributes: last name, first name, id, array of hours worked weekly. Include a constructor, the accessors and mutators, and method toString. Also code the following methods: one returning the average weekly hours and a method to add the hours to the array of hoursWorked (this means creating a large array). Let this array store the weekly hours (not daily hours) worked for each student employee. Write a client class to create 2 student objects and test all your methods.

I've been working for a few days and I'm not sure why I can't figure it out.

Please show using only import.java.util.Scanner/ import java.io.*; Thank you.

In: Computer Science

1. Using Induction on the length of derivations, prove that the set of all Primitive Recursive...

1. Using Induction on the length of derivations, prove that the set of all Primitive Recursive Functions (PR) is a subset of all Partial Computable Functions (P).

2. Using the preceding problem, conclude that the set of all Primitive Recursive Functions (PR) is a subset of all Computable Functions (R).

In: Computer Science

1. Suppose you are implementing software to be used in a handheld device that checks whether...

1. Suppose you are implementing software to be used in a handheld device that checks whether event attendees are part of a group of people allowed access to a special session at the event. Guests can purchase access to the special session any time up to the instant the event begins, and the device receives updated records to ensure paying guests (only) are allowed in to the special session Would choosing a set data structure to manage the special session guests or a list be more efficient? Explain

In: Computer Science

using MIPs assembly, ask the user to enter two numbers. Then multiply the two numbers using...

using MIPs assembly, ask the user to enter two numbers. Then multiply the two numbers using bit shifting (not 'mul'). This should work multiplying 2 positive numbers, 2 negative numbers, and a positive/negative number.

Then output the result and ask user if he/she has more calculations to complete.

In: Computer Science

Using Clion (an app that could use C++) to do this question: Create a new project...

Using Clion (an app that could use C++) to do this question:
Create a new project called Lab05b. Keep the main file named main.
• Write a function readAndPrint, and power with parameters noted below in the Functions.h file.
//Your Last Name
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
/*reads from a file
and prints every item to the screen*/
// file contains sets of
//int
//string
//Don't forget to use infile.ignore() between << and getline
//ifstream must be passed by reference
void readAndPrint(ifstream &infile);
//uses a for loop to return the base to the exponent
//e.g. 2^4 = 16
// this fuction should read data.txt file
long power(long base, long exponent);
#endif
• You should place the function prototypes in a file called Functions.h The function prototype has a semi-colon at the end.
• Then you should implement in a file called Functions.cpp
• Finally, declare the infile, and call the readAndPrint function. Then look at the power of 2^3 and 10 ^ 4
• Create a file named data.txt that has the following information.
1
Alpha
2
Beta
3
Gamma
• Your functions.cpp AND your lastnamefirstLab05b.cpp should #include “Functions.h”.
• Remember that you should not #include.cpp files!
• Implementation detail 4: compile and run with:
Run your code
Please take screenshots of Lab05b.cpp, Functions.h, and Functions.cpp.
Thanks for your help!

In: Computer Science

Respond to the following in a minimum of 175 words: Discuss the wireless spectrum and how...

Respond to the following in a minimum of 175 words:


Discuss the wireless spectrum and how it relates to a wireless network. What frequency ranges, or bands, are associated with wi-fi use? How does wi-fi transmission differ from data transmission over a physical network? How might that difference affect data security over a wi-fi network?


In: Computer Science

Two Systems 80 Km apart are communicating through a direct Metallic cable (note: signal speed is...

Two Systems 80 Km apart are communicating through a direct Metallic cable (note: signal speed is 2 x 10^8 m/s). The data is in the form of 60 KB packets with transmission rate 1M bps. Calculate the following:

  1. Data transmission time per packet.
  2. Propagation delay.
  3. bit duration.
  4. Bit length.
  5. Number of bits in the cable between the sender and receive

In: Computer Science