Questions
1. In Raptor, Prompt for and input a saleswoman’s sales for the month (in dollars) and...

1. In Raptor, Prompt for and input a saleswoman’s sales for the month (in dollars) and her commission rate (as a percentage). Output her commission for that month. Note that you will need to convert the percentage to a decimal. You will need the following variables: SalesAmount CommissionRate CommissionEarned You will need the following formula: CommissionEarned = SalesAmount * (CommissionRate/100).

In: Computer Science

(+30) Write a python program that generates four random between -50 and +50 using python’s random...

(+30) Write a python program that generates four random between -50 and +50 using python’s random number generator (RNG) see the following code (modify as needed )

import random
a = 10 # FIX
b =100 # FIX
x = random.randint(a,b) # (1) returns an integer a <= x <= b

# modify a and b according to the lab requirement
print('random integer == ', x)

and displays

  1. the four integers
  2. The maximum integer
  3. The minimum integer
  4. The number of even integers (if x %2 == 0 then x is even)
  5. The number of odd integers
  6. The number of integers greater than -25 but less than 25
  7. The number of positive integers
  8. The number of negative integers
  9. The average of the smallest and largest integers
  10. The average of all four integers

EXAMPLE OUTPUT

If the RNG generated the four integers 22 -8 17 -5 then display

  1. The integers are 22 -8 17 -5
  2. The maximum integer is 22
  3. The minimum integer is -8
  4. The number of even integers is 2
  5. The number of odd integers is 2
  6. The number of integers greater than -25 but less than 25 is 4
  7. The number of positive integers 2
  8. The number of negative integers   2
  9. The average of the smallest and largest integers 7.0
  10. The average of the four integers is 6.5

In: Computer Science

Which of the following is most likely to shift the demand curve for electricity to the...

Which of the following is most likely to shift the demand curve for electricity to the left?

Sugar and honey are viewed as substitutes for each other in many cooking applications. If the price of sugar rises, we would expect the:

The long-run equilibrium condition for perfect competition is:

Exhibit 4-11 Data on supply and demand

Bushels demanded
per month

Price per
bushel

Bushels supplied
per month

45

$5

77

50

  4

73

56

  3

68

61

  2

61

67

  1

57

In Exhibit 4-11, the equilibrium price per bushel of wheat is:


In: Economics

use *python Though CPUs, and computer hardware in-general, are not the main focus of this course,...

use *python

Though CPUs, and computer hardware in-general, are not the main focus of this course, it can be useful to know a thing or two about computer hardware. The CPU (Central Processing Unit) is generally the piece of hardware that carries out the instructions of the python programs that you run in this class.

In this short PA, you will write a program that takes a few input values related to CPU performance. The program should determine whether or not the specified CPU is within one of four categories: high-performance, medium-performance, low-performance, and in need of an upgrade. Name the file cpu.py. Shown below is an example of the program prompting the user for three inputs, and then printing out the corresponding CPU performance category:

Press ENTER or type command to continue
Enter CPU gigahertz:
2.7
Enter CPU core count:
2
Enter CPU hyperthreading (True or False):
False

That is a low-performance CPU
  • The first input, Gigahertz, should be converted to a float
  • The second input, core count, should be an integer
  • The third input, hyperthreading, should be a boolean. You should think of a way to go from a string 'True' or 'False' into a boolean True or False. (In case you were wondering, hyperthreading is a feature of some CPUs allowing for better performancce).

The program should spit out one of 4 strings:

  • That is a high-performance CPU.
  • That is a medium-performance CPU.
  • That is a low-performance CPU.
  • That CPU could use an upgrade.

How you determine which to print out should be based on the below tables:

If the CPU has hyperthreading

performance level min GHz min cores
high-performance 2.7 6
medium-performance 2.4 4
low-performance 1.9 2

If the CPU does not have hyperthreading

performance level min GHz min cores
high-performance 3.2 8
medium-performance 2.8 6
low-performance 2.4 2

There’s also one “special-case” rule: If a CPU has 20 or more cores, regardless of the other stats, it should be considered high-performance.

Examples

Below are several examples of program runs. There will be more tests on Gradescope.

Enter CPU gigahertz:
2.0
Enter CPU core count:
8
Enter CPU hyperthreading (True or False):
True

That is a low-performance CPU.
Enter CPU gigahertz:
4.0
Enter CPU core count:
6
Enter CPU hyperthreading (True or False):
False

That is a medium-performance CPU.

In: Computer Science

Trust-based relationships Instructions: answer the questions below based on your perspective from Part Two. 1. What...

Trust-based relationships Instructions: answer the questions below based on your perspective from Part Two. 1. What is the status of my relationships with key project team members and customers? List one key project team member and one customer (internal or external customer) and discuss the nature and state of the relationships. 2. Which relationships cause me the most pain (friction, confrontation, dishonesty, etc.)? List the relationships and pain points. 3. Which specific actions can I take to turn the troubled relationships into positive, healthy relationships?

In: Operations Management

Implement the following functions. Each function deals with null terminated C-strings. You can assume that any...

Implement the following functions. Each function deals with null terminated C-strings. You can assume that any char array passed into the functions will contain valid, null-terminated data. Your functions must have the signatures listed below.

1. This function returns the last index where the target char can be found in the string. it returns -1 if the target char does not appear in the string. For example, if s is “Giants” and target is ‘a’ the function returns 2.

int lastIndexOf(char *s, char target)

2. This function alters any string that is passed in. It should reverse the string. If “flower” gets passed in it should be reversed in place to “rewolf”. To be clear, just printing out the string in reverse order is insufficient to receive credit, you must change the actual string to be in reverse order.

void reverse(char *s)

3. This function finds all instances of the char ‘target’ in the string and replaces them with ‘replacementChar’. It also returns the number of replacements that it makes. If the target char does not appear in the string it returns 0 and does not change the string. For example, if s is “go giants”, target is ‘g’, and replacement is ‘G’, the function should change s to “Go Giants” and return 2.

int replace(char *s, char target, char replacementChar)

4. This function returns the index in string s where the substring can first be found. For example if s is “Skyscraper” and substring is “ysc” the function would return 2. It should return -1 if the substring does not appear in the string.

int findSubstring(char *s, char substring[])

5. This function returns true if the argument string is a palindrome. It returns false if it is not. A palindrome is a string that is spelled the same as its reverse. For example “abba” is a palindrome. So is “hannah”, “abc cba”, and “radar”.

bool isPalindrome(char *s)

Note: do not get confused by white space characters. They should not get any special treatment. “abc ba” is not a palindrome. It is not identical to its reverse.

6.This function should reverse the words in a string. Without using a second array. A word can be considered to be any characters, including punctuation, separated by spaces (only spaces, not tabs, \n etc.). So, for example, if s is “The Giants won the Pennant!” the function should change s to “Pennant! the won Giants The”.

void reverseWords(char *s)

Requirements

- You may use strlen(), strcmp(), and strncpy() if you wish, but you may not use any of the other C-string library functions such as strstr(), strncat(), etc.

- You will not receive credit for solutions which use C++ string objects, you must use C-Strings (null-terminated arrays of chars) for this assignment.

In: Computer Science

I have an excel file imported into canopy (python) using import pandas as pd. The excel...

I have an excel file imported into canopy (python) using import pandas as pd. The excel file has headers titled:

datetime created_at PM25 temperatureF dewpointF    humidityPCNT windMPH    wind_speedMPH wind_gustsMPH pressureIN precipIN

these column headers all have thousands of data numbers under them. How could i find the average of all of the numbers in each column and plot them on 1 graph (line graph or scatter plot) Thank you.(please comment out your code)

In: Computer Science

the specific heat of copper (0.092) and the specific heat of silver is (0.056). The mass...

the specific heat of copper (0.092) and the specific heat of silver is (0.056). The mass of silver is 1.02 times greater than the mass of the copper. The heat gained by the silver is 1.33 times the heat gained by copper. The temperature change of copper is 20 degrees Celsius. What is the temperature change of the silver?

In: Physics

In this assignment, you will be implementing a slot machine that you find in casinos. A...

In this assignment, you will be implementing a slot machine that you find in casinos. A slot machine has certain number of reels which spin to produce one of a fixed set of symbols (e.g. flowers, bells) randomly when the user pulls a lever. The user needs to insert certain number of currency units as wager into the slot machine before pulling the lever. We refer to these currency units as “wagerUnitValue”. For example in slot machines with quarter (25 cents) as wagerUnitValue , user needs to insert one or more quarters while in dollar slot machines where wagerUnitValue = 100, user needs to insert one or more dollars as wager before pulling the lever. The user will receive a payout based on the matching of symbols on the reels. In a real slot machine there is a payout table which specifies the payout for certain combinations of symbols on the reels. In this assignment, you will instead be implementing simple payout rules based on number of matched symbols.

I have provided a skeletal implementation of a slot machine to help you get started (Check Moodle). Do not change class name, enum type or function signatures. You can however add some variables as needed. Specifically implement the following functions: (a) SlotMachine class constructor which has the following parameters: (i) numReels, (ii) odds array with one entry per symbol indicating probability of getting the symbol in a reel and (iii) wagerUnitValue in cents. (b) getSymbolForAReel() – use Math.random() to generate a random number between 0 and 1 and then use the odds array to generate a symbol randomly. (c) calcPayout() – calculate and return payout value for the given symbols on the reels; use the rules provided in the comments section of the function (d) pullLever() – this function simulates user pulling lever in the slot machine after inserting a wager. First use the function in (b), to generate symbol for each reel and then use the function in (c) to calculate the payout. You can assume that the symbols on the reels appear as independent random events. You need to print the reel symbols in a line followed by the payout in dollar format in another line. (e) getPayoutPercent() – you need to keep track of total wager given by the user as well as total payout provided to the user; this function calculates the total payout as a percent of the total wager value. (f) reset() – clears the total wager and total payout value for fresh calculation of payout percent. Submit only the SlotMachine.java file with your name added in comments section. You can use the main() function to test your program but it is not graded. The test program used for grading will call the class functions (a)-(f) directly.

package edu.stevens.cs570.assignments;

public class SlotMachine {

public enum Symbol {

BELLS("Bells", 10), FLOWERS("Flowers", 5), FRUITS("Fruits", 3),

HEARTS("Hearts", 2), SPADES("Spades", 1);

// symbol name

private final String name;

// payout factor (i.e. multiple of wager) when matching symbols of this

type

private final int payoutFactor;

Symbol(String name, int payoutFactor) {

this.name = name;

this.payoutFactor = payoutFactor;

}

public String getName() {

return name;

}

public int getPayoutFactor() {

return payoutFactor;

}

}

/**

* Constructor

* @param numReels number of reels in slot machine

* @param odds odds for each symbol in a reel, indexed by its enum ordinal

value; odds value is non-zero and sums to 1

* @param wagerUnitValue unit value in cents of a wager

*/

public SlotMachine(int numReels, double [] odds, int wagerUnitValue) {

}

/**

* Get symbol for a reel when the user pulls slot machine lever

* @return symbol type based on odds (use Math.random())

*/

public Symbol getSymbolForAReel() {

return null;

}

/**

* Calculate the payout for reel symbols based on the following rules:

* 1. If more than half but not all of the reels have the same symbol then

payout factor is same as payout factor of the symbol

* 2. If all of the reels have the same symbol then payout factor is twice the

payout factor of the symbol

* 3. Otherwise payout factor is 0

* Payout is then calculated as wagerValue multiplied by payout factor

* @param reelSymbols array of symbols one for each reel

* @param wagerValue value of wager given by the user

* @return calculated payout

*/

public long calcPayout(Symbol[] reelSymbols, int wagerValue) {

return 0;

}

/**

* Called when the user pulls the lever after putting wager tokens

* 1. Get symbols for the reels using getSymbolForAReel()

* 2. Calculate payout using calcPayout()

* 3. Display the symbols, e.g. Bells Flowers Flowers..

* 4. Display the payout in dollars and cents e.g. $2.50

* 5. Keep track of total payout and total receipts from wagers

* @param numWagerUnits number of wager units given by the user

*/

public void pullLever(int numWagerUnits) {

}

/**

* Get total payout to the user as percent of total wager value

* @return e.g. 85.5

*/

public double getPayoutPercent() {

return 0;

}

/**

* Clear the total payout and wager value

*/

public void reset() {

}

public static void main(String [] args) {

double [] odds = new double[Symbol.values().length];

// sum of odds array values must equal 1.0

odds[Symbol.HEARTS.ordinal()] = 0.3;

odds[Symbol.SPADES.ordinal()] = 0.25;

odds[Symbol.BELLS.ordinal()] = 0.05;

odds[Symbol.FLOWERS.ordinal()] = 0.2;

odds[Symbol.FRUITS.ordinal()] = 0.2;

SlotMachine sm = new SlotMachine(3, odds, 25); // quarter slot machine

sm.pullLever(2);

sm.pullLever(1);

sm.pullLever(3);

System.out.println("Pay out percent to user = " + sm.getPayoutPercent());

sm.reset();

sm.pullLever(4);

sm.pullLever(1);

sm.pullLever(1);

sm.pullLever(2);

System.out.println("Pay out percent to user = " + sm.getPayoutPercent());

}

}

This is Sample Output:

Spades Hearts Flowers

payout=$0.00

Flowers Hearts Hearts

payout=$0.50

Flowers Spades Spades

payout=$0.75

Pay out percent to user = 83.33333333333333

Spades Flowers Hearts

payout=$0.00

Spades Hearts Flowers

payout=$0.00

Fruits Hearts Hearts

payout=$0.50

Hearts Spades Fruits

payout=$0.00

Pay out percent to user = 25.0

In: Computer Science

I need 2 clarification questions about the "OWN IT" book by Oprah Winfrey with a quote.

I need 2 clarification questions about the "OWN IT" book by Oprah Winfrey with a quote.

In: Psychology

We are evaluating a project that costs $106,559, has a seven-year life, and has no salvage...

We are evaluating a project that costs $106,559, has a seven-year life, and has no salvage value. Assume that depreciation is straight-line to zero over the life of the project. Sales are projected at 4,308 units per year. Price per unit is $47, variable cost per unit is $29, and fixed costs are $82,563 per year. The tax rate is 40 percent, and we require a 11 percent return on this project. Suppose the projections given for price, quantity, variable costs, and fixed costs are all accurate to within +/-12 percent. What is the NPV of the project in worst-case scenario?

In: Finance

Explain the Role of the safety professional in all phases of systems designs.

Explain the Role of the safety professional in all phases of systems designs.

In: Operations Management

Create a testbench in Verilog for the following module (logic). Verify the testbench works in your...

Create a testbench in Verilog for the following module (logic). Verify the testbench works in your answer. I'll upvote correct answers.

This module does the following. The algorithm takes an input between 0 and 255 (in unsigned binary and counts the number of ones in each number (ex. 01010101 has 4 ones). Then the output would be 00000100 (4 in binary because there are 4 ones.

The test bench would need to verify the inputs and outputs of each number. Test 5 different numbers and ensure the output is expected for the input.

module logic(
  input [7:0] A, //input is between 0-255, so 8 bits.
  output reg [3:0] ones // 0-3 because, at max there can be 8 ones. As, 8 can be represented in 3 bits.
  );

integer i;// declaration of vailable i

always@(A)
begin
ones = 0;  //initialize count variable.
  for(i=0;i<8;i=i+1)   //Iterate all the bits. As input lies between 0 & 255, so, 8 bits.
ones = ones + A[i]; //Adding the bit to the count.
end

endmodule

In: Computer Science

Fact Scenario:                    Quik Results, Inc.(QRI), a Michigan corporation, makes and sells Power Up!, a super...

Fact Scenario:

                   Quik Results, Inc.(QRI), a Michigan corporation, makes and sells Power Up!, a super energy boosting, carbonated beverage. Power Up! is made in Michigan, but shipped to stores all across the Midwest and East Coast. Power Up! is made by QRI, and delivered on QRI. trucks, by QRI employees. QRI has in-house accounting and marketing staff.

                  Steve, a driver for QRI, leaves the truck's motor running in neutral and carelessly forgets to set the parking brake while he makes a delivery. The truck rolls and crashes into a nearby gas station pump, igniting a fire that spreads quickly to a construction site a block away. A burned wall collapses onto a crane, which falls on, and injures, a bystander, Flo. What must Flo show to recover damages from Steve? What are QRI’s potential liabilities?

In: Operations Management

Sam’s small bread company has been operating out of his kitchen and selling at local farmer’s...

Sam’s small bread company has been operating out of his kitchen and selling at local farmer’s markets. Recently he was informed by a government official his bread does not have the proper _____________ because there are no nutritional facts on the bag.

Select one:

Labelling

Branding

Packaging

Description

Compliance

Your company has traditionally advertised on radio, but you would like to expand your promotions to include more social media and participation in trade shows. What is the most serious concern when contracting multiple different agencies to develop these different campaigns?

Select one:

Conflicts of interest arising.

Out of control costs.

A lack of target-focused marketing.

A mixed and inconsistent message to consumers.

The design of marketing communications program.

Sally works for a car dealership. Her job is to survey customers to see how much they value offerings such as warranties or guarantees. This will help her in designing new ______________ in the future.

Select one:

Brochures

Training processes

Vehicles

Actual products

Augmented products

In: Operations Management