Write python code which displays the sales commission based on the total sale and the employee’s region, using on the following table.
|
Total Sale |
Region |
Commission |
|
Under $2,500 |
East |
5% |
|
$2,500 or more |
East |
7.5% |
|
Under $2,500 |
West |
10% |
|
$2,500 or more |
West |
12.5% |
In: Computer Science
A professor wants to do some research on students who use different kinds of computers. They are curious if there is any difference in average test scores between , for instance, Mac users and Windows users. Write a program to help with this, that behaves as follows.
In: Computer Science
Please complete a program that will be an order entry program for a store or
organization. The program will accept order entry input from two customers, calculate
the total order amount of each order and display data about each order to the
customer. There will be two orders, one will be a “delivery” order and the other will be a “pickup” order.
The data entered by each customer will be:
Customer name
Item purchased
Quantity purchased
Price of the item
The information displayed for each customer order will be:
Order Date (system generated)
Delivery Location (hardcoded in constructor)
Order Type (program supplied)
Item description
Price
Quantity
Order total (program calculates)
Delivery Charge (constant = $10.00)
You can follow these steps to guide you through the process.
1. Create a public class named Order.
2. The Order class will have instance variables for each object to hold data pertaining to each
object as needed (for the input from the customer, program calculated and system generated
values).
3. The Order class will have two constructors (both considered overloaded) of which will set the
current system date for the order as well as the delivery type (Hint: use the LocalDate class for
the date).
a. One constructor will accept a parameter for the address and will be called when a
delivery order is placed. It will set a delivery type instance variable value as “delivery”.
b. The second overloaded constructor will not require a parameter for the address when a
pickup order is placed. It will set a delivery type instance variable value as “pickup”.
4. Create a second public class named OrderCart.
5. Create a main() method within the OrderCart class that will do the following:
a. Display a greeting.
b. Instantiate two Order class objects one for “pickup” and one for “delivery”.
o The “delivery” class object will pass a delivery address argument to the constructor.
At this time, you should hard code an address into the call to the constructor to
keep it simple. (Decision structures are not needed and therefore not used for this
program).
o The “pickup” class object will not pass any delivery information to the constructor.
c. Prompts and accepts input from the user for the all of the instance variables (customer
name, item description, quantity and price).
d. Calls two overloaded methods named calculateOrderTotal() to calculate the order total of
each order (no sales tax is charged in this example). Each method accepts an “Order”
object as it’s parameter.
o One overloaded method will accept a delivery charge of $10.00 and will be used to
calculate the order total for the “delivery” order. The total should include the
delivery charge (total = price * quantity + delivery charge).
o The second overloaded method will not accept any delivery charges and will used
to calculate the order total for the “pickup” order. The total charge will not include
a delivery charge (total = price * quantity).
o
e. Calls two overloaded methods named displayOrderData() to output the data for each
order. Each method accepts an “Order” object as it’s parameter.
o One overloaded method will accept a delivery charge of $10.00 and will be used to
display the order details including the delivery charge.
o The second overloaded method will not accept any delivery charges and will used
display the order specifics.
In: Computer Science
Assignment task
Use your favorite search engine to find details about (1) virus/piece of malware. Upload an MS Word or .PDF document that summarizes each of the following
Item 1: Introduction - What is meant by malware/viruses? What is their history? Are malware and/or viruses recent developments in computer technology or have they been around for a while? What piece of malware/virus are choosing to write about and why?
Item 2: Virus/Malware details:
What specifically does the virus/malware do? How does it infect targets? What does it do once it infects a host? Does it change registry settings, does it leave behind malicious code, etc...? Is it destructive? If so how?
In: Computer Science
""don't use hand write""
The software design/development team and test engineers need to develop a strategy for planning, design, execution, data collection, and test evaluation”. Discuss this statement.
In: Computer Science
Use the following code fragment:
1 sub x4,x4,x0
2 add x3,x4,x0
3 sub x6,x3,x2
4 mul x1,x6,x7
5 add x2,x5,x9
6 div x5,x9,x2
7 add x8,x1,x4
Draw the dependency graph among the instructions and indicate the type of data hazards (such as RAW, WAW, etc.) on each edge.
In: Computer Science
write a c++ program to perform the following operations on stack of Integers (Array Implementation of Stack with maximum size MAX)
(i) Push an Element on to stack
(ii) Pop an Element from stack
(iii) Demonstrate how stack can be used to check Palindrome
(iv) Display the status of stack
(v) Exit
In: Computer Science
4. Please name your driver program XXX_P04 where XXX are your initials. Given the array inputArray (doubles), write a method called swap which will swap any two contiguous (next to each other) elements. Swap will be passed two parameters, the index of the first element to be swapped and the array name. Write another method printArray that will print the array 5 elements to a line. PrintArray will be passed one parameter the array name. See the videos for help with this. The array elements are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
Java Eclipse
In: Computer Science
Q1. [10 pt] How will you implement a binary semaphore with block wake-up protocol? Give the code.
(Please help, Operating system question, 2011 Spring)
In: Computer Science
Create a project with a Program class and write the following two methods (headers provided) as described below:
In: Computer Science
In: Computer Science
Python
Write a function str_slice(s) to slice sentence into single word by
their spaces and punctuations and returns a list.
You cannot use split(), join() method for this define
function
Example:
>>>str_slice(‘Hi, I like it!!’)
[‘Hi’, ‘, ’, 'I', ‘ ‘, ‘like’, ‘ ‘, ‘it’, ‘!!’]
In: Computer Science
This program has to be written in assembly language using emu8086. Please choose the .EXE template. The requirements and the action is contained in the docx file.
You’ve been hired by Spacely Sprockets and they need to be able to write order information out to a file. Using all of the knowledge that we’ve gained in the last few sections on structures and files, you need to write a program that does the following:
Here’s a sample run:
Order Number: 105
Customer ID: 405
Sprocket Type: Awesome Atomic Sprocket
Part Quantity: 3
Order Total: 105.74
Struct written to file C:\asm\test.txt
Order Number: 105
Customer ID: 405
Sprocket Type: Awesome Atomic Sprocket
Part Quantity: 3
Order Total: 105.74
Program Complete!
Hints: Think procedures! You can simplify the code and your debugging life by writing procedures. For example, a print structure routine, a save to file routine, a read from file routine, et cetera. Secondly, DO NOT code this application in a single shot – incrementally build up each piece of logic otherwise you will get lost when things don’t work right.
In: Computer Science
/*
Test#1:
Please type 0 for the Fibonacci sequenceÂ
Please type 1 for the Fibonacci square matrixÂ
Please type 2 for the flipped Fibonacci square matrix based on Y-axisÂ
Please type 3 for the flipped Fibonacci square matrix based on X-axisÂ
0
Please enter size for the Fibonacci sequence (size <100)Â
10
0 1 1 2 3 5 8 13 21 34Â
Median of the Fibonacci sequence is 4.000000
Test#2:
Please type 0 for the Fibonacci sequenceÂ
Please type 1 for the Fibonacci square matrixÂ
Please type 2 for the flipped Fibonacci square matrix based on Y-axisÂ
Please type 3 for the flipped Fibonacci square matrix based on X-axisÂ
1
Please enter length of edge for the Fibonacci matrix (size <10)Â
4
The matrix isÂ
0 1 1 2Â
3 5 8 13Â
21 34 55 89Â
144 233 377 610Â
Test#3:
Please type 0 for the Fibonacci sequenceÂ
Please type 1 for the Fibonacci square matrixÂ
Please type 2 for the flipped Fibonacci square matrix based on Y-axisÂ
Please type 3 for the flipped Fibonacci square matrix based on X-axisÂ
2
Please enter length of edge for the Fibonacci matrix (size <10)Â
4
The matrix isÂ
2 1 1 0Â
13 8 5 3Â
89 55 34 21Â
610 377 233 144Â
Test#4:
Please type 0 for the Fibonacci sequenceÂ
Please type 1 for the Fibonacci square matrixÂ
Please type 2 for the flipped Fibonacci square matrix based on Y-axisÂ
Please type 3 for the flipped Fibonacci square matrix based on X-axisÂ
3
Please enter length of edge for the Fibonacci matrix (size <10)Â
4
The matrix isÂ
144 233 377 610Â
21 34 55 89Â
3 5 8 13Â
0 1 1 2Â
Of course, your program cannot just satisfy above four test cases.
It should be generalized to satisfy any Fibonacci sequence (size <100) and Fibonacci Matrix (< 10x10).
*/
#include <stdio.h>
//@Hint: put the function you need here
int main() {
int a[100]; //For Fibonacci sequence
int fibonacciMatrix[10][10]; //For Fibonacci Matrix
int num = 0;
float median = 0.0; //Median number of the Fibonacci sequence
int choice = 0;
int lengthFbSequence = 0; //the length of Fibonacci sequence
int lengthFbMatrix = 0; //the length of the edge of Fibonacci Matrix
printf("Please type 0 for the Fibonacci sequence \n");
printf("Please type 1 for the Fibonacci square matrix \n");
printf("Please type 2 for the flipped Fibonacci square matrix based on Y-axis \n");
printf("Please type 3 for the flipped Fibonacci square matrix based on X-axis \n");
scanf("%d", &choice);
while (choice < 0) {
printf("Please type 0 for the Fibonacci sequence \n");
printf("Please type 1 for the Fibonacci matrix \n");
printf("Please type 2 for the flipped Fibonacci square matrix based on Y-axis \n");
printf("Please type 3 for the flipped Fibonacci square matrix based on X-axis \n");
scanf("%d", &choice);
}
if (choice == 0) {
printf("Please enter size for the Fibonacci sequence (size <100) \n");
scanf("%d", &lengthFbSequence);
while (lengthFbSequence < 0) {
printf("Please enter size for the Fibonacci sequence (size <100) \n");
scanf("%d", &lengthFbSequence);
}
//@Hint: Please start to code for option 0
}
if (choice == 1 || choice == 2 || choice == 3) {
printf("Please enter length of edge for the Fibonacci matrix (size <10) \n");
scanf("%d", &lengthFbMatrix);
while (lengthFbMatrix < 0) {
printf("Please enter length of edge for the Fibonacci matrix (size <10) \n");
scanf("%d", &lengthFbMatrix);
}
//@Hint: Please start to code for option 1, 2, 3
}
return 0;
}In: Computer Science
acos() Prototype
double acos(double x);
To find arc cosine of type int, float or long double, you can explicitly convert the type to double using cast operator.
int x = 0; double result; result = acos(double(x));
int x = 0; double result; result = acos(double(x));
acos() Parameter
The acos() function takes a single argument in the range of [-1, +1]. It's because the value of cosine is in the range of 1 and -1.
| Parameter | Description |
|---|---|
| double value | Required. A double value between - 1 and +1 inclusive. |
acos() Return Value
The acos() functions returns the value in range of [0.0, π] in radians. If the parameter passed to the acos() function is less than -1 or greater than 1, the function returns NaN (not a number).
| Parameter (x) | Return Value |
|---|---|
| x = [-1, +1] | [0, π] in radians |
| -1 > x or x > 1 | NaN (not a number) |
Example 1: acos() function with different parameters
#include <stdio.h>
#include <math.h>
int main() {
// constant PI is defined
const double PI = 3.1415926;
double x, result;
x = -0.5;
result = acos(x);
printf("Inverse of cos(%.2f) = %.2lf in radians\n", x, result);
// converting radians to degree
result = acos(x)*180/PI;
printf("Inverse of cos(%.2f) = %.2lf in degrees\n", x, result);
// paramter not in range
x = 1.2;
result = acos(x);
printf("Inverse of cos(%.2f) = %.2lf", x, result);
return 0;
}
Output
Inverse of cos(-0.50) = 2.09 in radians Inverse of cos(-0.50) = 120.00 in degrees Inverse of cos(1.20) = nan
give an example of (math.h) function from the c language library and explain
1- prototype
2-input type (parameters)
3-output or return type
4- number of arguments/parameters
5- example
In: Computer Science