(SQL Coding)
Create a read only view called view_emp_salary_rank_ro that selects the last name and salary from the o_employees table and ranks the salaries from highest to lowest for the top three employees.
In: Computer Science
Write a program with two input values, Hours and Rate. The program should first calculate Gross pay, which is your pay before deductions. The program should then calculate the following three deduction amounts: Federal Tax (20% of Gross), State Tax (5% of Gross), Social Security Tax (6.2% of Gross). Then your program should calculate Net pay, which is your Gross pay minus the three deductions. The output should be all five of the calculated values.
In: Computer Science
JAVA PROGRAM, Create the game "Rock, Scissor, Paper":
In: Computer Science
For each of the following scenarios / consumers, to which type
of Cloud service model is it best suited?
1) Using Cloud storage for long-term archiving of financial
records.
2) Outsourcing an organization’s VoIP IT systems to public Cloud providers.
In: Computer Science
Program 3: Command Line Calculator
Topics: Functions or methods, global variables
Overview
You will build a simple command line calculator. It supports addition (add), subtraction (sub), multiplication (mul), division (div), and calculation of the absolute value (abs). You will use functions to support each type of calculation. You can assume that the numbers are float data types.
Software Specifications
The user interacts with program by entering a command, followed by some parameters at the command prompt “>”. For example, if the user wants to add 4 and 5, he/she enters “add 4 5” and hits the return key. The system then outputs the result of the addition command (in this case, 9). See sample run output below for more examples.
Once the command’s operation is completed, the system goes back to the command prompt waiting for another command from the user. The commands are “add”, “sub”, “mul”, “div”, and “abs”. All the commands take two arguments except for “abs” which takes one argument. Each command will call the corresponding function to perform the calculation. Name each function the same name as the command. The “quit” command calls the printStats function and ends the program. The printStats function prints the number of times each function were called (executed). To keep track of function call usage, you will need global variables which can be shared across functions.
|
Command |
# of arguments |
Behavior |
|
add |
2 |
Adds the two arguments. |
|
sub |
2 |
Subtracts the second argument from the first argument. |
|
mul |
2 |
Multiplies the two arguments. |
|
div |
2 |
Divides the first argument by the second argument. If the second argument is 0, print “Error: Division by zero” and return 0. |
|
abs |
1 |
Computes the absolute value of the argument. |
|
quit |
0 |
Prints the function usage statistics, and ends the program. |
Parsing the command line
Your program will read the command as a single line. It then splits it into several tokens. The first is the command. Any other tokens after the first are the parameters. To parse a command, simply use the split function on the string. Don’t forget to convert the parameters to floats so that you can perform arithmetic operations.
The code below shows you how to use the split function to extract the command and the parameters.
>>> userinput="add 1 2"
>>> tokens = userinput.split(" ")
>>> print(tokens[0])
add
>>> print(tokens[1])
1
>>> print(tokens[2])
2
Sample Outputs
Welcome to iCalculator.
>add 3 4.0
7.0
>mul 3 5
15.0
>abs 5
5.0
>abs -7
7.0
>abs 8
8.0
>quit
Function usage count
add function : 1
sub function : 0
mul function : 1
div function : 0
abs function : 3
In: Computer Science
Implement a stack in C++ using an array, not an array list.
Make your stack size 5 when you test it, but do not hardcode this! You should be able to change the size for testing purposes with the change of one variable.
DO NOT use Stack class defined in C++
Implement the following methods in your stack class.
Write your own Driver file to show that you have implemented all the methods of the stack. A psuedocode example is listed below to guide you. Use print statements as well to show the popped elements, to show the stack after some pushes, to print the size of the stack.
In: Computer Science
Python - Rewriting a Program
Rewrite Program 1 using functions. The required functions are in the table below.
Create a Python program that will calculate the user’s net pay based on the tax bracket he/she is in. Your program will prompt the user for their first name, last name, their monthly gross pay, and the number of dependents.
The number of dependents will determine which tax bracket the user ends up in. The tax bracket is as follows:
After calculating the net pay, print the name of the user, the monthly gross pay, the number of dependents, the gross pay, the tax rate, and the net pay.
The formula to compute the net pay is: monthly gross pay – (monthly pay * tax rate)
|
function |
Description |
|
read_name() |
Reads the name entered, and returns the name. |
|
read_gross_pay() |
Reads the gross pay amount, and returns the amount. |
|
read_dependents() |
Reads the number of dependents, and returns the number. |
|
compute_tax_rate(dependents) |
Computes and returns the tax rate, based on the number of dependents. |
|
compute_net_pay(gross_pay, rate) |
Computes and returns the net pay, based on the gross pay and the tax rate. |
|
main() |
Main function of the program. |
Sample run:
Enter your name: Ron Swanson
Enter your gross pay: $3500
Enter number of dependents: 0
Name: Ron Swanson
Gross pay: $3500.00
Dependents: 0
Tax rate: 20%
Net Pay: $2800.00
In: Computer Science
Simplify (A xor B) + (A xor C) using K-maps, does (A xor B) + (B xor C) have the same K-map?
In: Computer Science
•A theater owner agrees to donate a portion of gross ticket sales to a charity
•The program will prompt the user to input:
−Movie name
−Adult ticket price
−Child ticket price
−Number of adult tickets sold
−Number of child tickets sold
−Percentage of gross amount to be donated
•Inputs: movie name, adult and child ticket price, # adult and child tickets sold, and percentage of the gross to be donated
•The program needs to:
1.Get the movie name
2.Get the price of an adult ticket price
3.Get the price of a child ticket price
4.Get the number of adult tickets sold
5.Get the number of child tickets sold
PLEASE USE C++
In: Computer Science
How do I make sure that this C code shows the letter P for one second then L a second later on a raspberry pi sense hat?
How do I make sure that this C code shows the letter P for one second then L a second later on a raspberry pi sense hat?
1 #include <stdio.h>
2 #include <unistd.h>
3 #include "sense.h"
4
5 #define WHITE 0xFFFF
6
7 int main(void) {
8 // getFrameBuffer should only get called
once/program
9 pi_framebuffer_t
*fb=getFrameBuffer();
10 sense_fb_bitmap_t
*bm=fb->bitmap;
11
12
13 // Letter P
14 bm->pixel[0][0]=WHITE;
15 bm->pixel[0][1]=WHITE;
16 bm->pixel[0][2]=WHITE;
17 bm->pixel[0][3]=WHITE;
18 bm->pixel[0][4]=WHITE;
19 bm->pixel[0][5]=WHITE;
20 bm->pixel[1][5]=WHITE;
21 bm->pixel[2][5]=WHITE;
22 bm->pixel[3][5]=WHITE;
23 bm->pixel[3][4]=WHITE;
24 bm->pixel[3][3]=WHITE;
25 bm->pixel[2][3]=WHITE;
26 bm->pixel[1][3]=WHITE;
27
28 /*
29 void drawCFB(void);
30 drawCFB();
31 */
32
33 sleep(1);
34
35
bm->pixel[0][0]=WHITE;
36 bm->pixel[0][1]=WHITE;
37 bm->pixel[0][2]=WHITE;
38 bm->pixel[0][3]=WHITE;
39 bm->pixel[0][4]=WHITE;
40 bm->pixel[0][5]=WHITE;
41 bm->pixel[1][0]=WHITE;
42 bm->pixel[2][0]=WHITE;
43 bm->pixel[3][0]=WHITE;
44
45
sleep(1);
46
47 return
0;
48 }
In: Computer Science
1) The provided reorder.cpp file has some code for a function that reorders the values in 3 parameters so that they are in ascending order.
·Start with a function void swap(int &val1, int &val2) that swaps the values of val1 and val2. You will need a local variable to hold the value of one of the parameters to let you do this.
·Write the reorder function called in main(). It should call swap() to exchange values when appropriate.
·Add statements to main() to be able to try out the 3 cases below
Driver to test reorder()
Case 1: values are already in correct order -- leave them alone
1 2 3
Case 2: first > second and first < third
-5 -2 0
Case 3: first > second > third
6 8 10
reorder.cpp
// Reordering values in variables
#include <iostream>
using namespace std;
// swap the values in the two reference integer parameters
void swap(int &val1, int &val2) {
}
// reorder 3 integer values so that
// first parameter has smallest value, second parameter has middle value,
// third parameter has largest value
int main()
{
int val1 = 1, val2 = 2, val3 = 3;
cout << "Driver to test reorder()" << endl;
cout << "Case 1: values are already in correct order -- leave them alone" << endl;
reorder(val1, val2, val3);
cout << val1 << " " << val2 << " " << val3 << endl;
return 0;
}In: Computer Science
Make a python function that inputs f : a function whose root you wish to find, x0 : an initial guess for the root, x1 : an second guess for the root, and k : a number of iterations, and output and outputs a list of the results of performing the secant method k times starting from x0 and x1. Use your function to check if the secant method has the claimed rate of convergence when applied to f ( x ) = e x + x starting with x 0 = 3 and x 1 = 2
In: Computer Science
using Python
In: Computer Science
Express each of these statements using quantifiers. Then form the negation of the statement sothat no negation is to the left of a quantifier. Next, express the negation in simple English. In eachcase, identify the domain and specify the predicates.
•No one has lost more than one thousand dollars playing the lottery.
•There is a student in this class who has chatted with exactly one other student.
•No student in this class has sent e-mail to exactly two other students in this class.•
Some student has solved every exercise in this book.
•No student has solved at least one exercise in every section of this book.
In: Computer Science
1. Briefly explain the differences between a semaphore and a condition variable, and what problem in common these two synchronization primitives solve.
In: Computer Science