Questions
This is to check to ensure you are current in your work. Please create a simple...

This is to check to ensure you are current in your work.

Please create a simple calculator with only +, - and divide. It has to be able to enter any numbers (including decimals) and be able to do the following functions:

+, -, divide and multiply.

Please have the answers, always rounded to two decimal figures. The calculator will also have to be able to take up to 5 values.

In: Computer Science

need a visual studio solution for the following: 1. Radio buttons that limit the us er...

need a visual studio solution for the following: 1. Radio buttons that limit the us er to only one choice (nested selection structure) 2. A group box for your radio buttons 3. Controls to prevent unwanted characters in text boxes 4. At least one message box 5. At least one select case statement

In: Computer Science

a)Explain the relationship between the cost performance index and schedule performance index. b)What is the purpose...

a)Explain the relationship between the cost performance index and schedule performance index.

b)What is the purpose of the work package? Who will create it?

In: Computer Science

Revise the MeanMedian class so that the user can enter any number of values up to...

Revise the MeanMedian class so that the user can enter any number of values up to 20. If the list has an even number of values, the median is the numeric average of the values in the two middle positions. Allow the user to enter 9999 to quit entering numbers.   

In: Computer Science

If no WHERE clause is used along with a __?__ join, it produces a result set...

If no WHERE clause is used along with a __?__ join, it produces a result set containing the number of rows in a first table multiplied by the number of rows in the second table (also known as the Cartesian product). ?

LEFT,

RIGHT,

INNER,

OUTER,

CROSS,

PARALLEL)

In: Computer Science

double_vowels Given a string, return a copy of the string with all of the vowels doubled....

double_vowels

Given a string, return a copy of the string with all of the vowels doubled. Consider the five letters 'aeiou' as vowels.


double_vowels('pencil') → 'peenciil'
double_vowels('xyzzy') → 'xyzzy'
double_vowels('catalog') → 'caataaloog'

middle_hash

Given a string, do three hash marks '###' appear in the middle of the string? To define middle, we'll say that the number of chars to the left and right of the '###' must differ by at most one.


middle_hash('aa###bb') → True
middle_hash('aaa###bb') → True
middle_hash('a###bbb') → False

fence_post

Given two strings, fence and post, return a string made up of count instances of post, separated by instances of fence.

<i>Note</i>: This is an example of the classic "fence post" programming problem. It's a variant of the off-by-one-error (OBOE).


fence_post('X', 'Word', 3) → 'WordXWordXWord'
fence_post('And', 'This', 2) → 'ThisAndThis'
fence_post('And', 'This', 1) → 'This'

balanced_x_y

We'll say that a String is xy-balanced if for all the 'x' chars in the string, there exists a 'y' char somewhere later in the string. So 'xxy' is balanced, but 'xyx' is not. One 'y' can balance multiple 'x's. Return true if the given string is xy-balanced.


balanced_x_y('aaxbby') → True
balanced_x_y('aaxbb') → False
balanced_x_y('yaaxbb') → False

repeated_prefix

Given a string, consider the prefix string made of the first N chars of the string. Does that prefix string appear somewhere else in the string? Assume that the string is not empty and that N is in the range 1..len(str).


repeated_prefix('abXYabc', 1) → True
repeated_prefix('abXYabc', 2) → True
repeated_prefix('abXYabc', 3) → False

In: Computer Science

Context switching occurs when a task surrenders the CPU to another task or is preempted by...

Context switching occurs when a task surrenders the CPU to another task or
is preempted by another task. Use program examples (pseudo code plus Gantt
charts) to show a scenario for each of the cases.

In: Computer Science

Below is what I have to do. This is all performed in SQL. I have written...

Below is what I have to do. This is all performed in SQL. I have written a bunch of code, that I have also provided. Any help is appreciated

Exercises

Complete each of the following exercises. If you are unsure how to accomplish the task, please consult the coursework videos where there are explanations and demos.

  1. Use built in SQL functions to write an SQL Select statement on fudgemart_products which derives a product_category column by extracting the last word in the product name. For example
    1. for a product named ‘Leather Jacket’ the product category would be ‘Jacket’
    2. for a product named ‘Straight Claw Hammer’ the category would be ‘Hammer’

Your select statement should include product id, product name, product category and product department.

  1. Write a user defined function called f_total_vendor_sales which calculates the sum of the wholesale price * quantity of all products sold for that vendor. There should be one number associated with each vendor id, which is the input into the function. Demonstrate the function works by executing an SQL select statement over all vendors calling the function.
  2. Write a stored procedure called p_write_vendor which when given a required vendor name, phone and optional website, will look up the vendor by name first. If the vendor exists, it will update the phone and website. If the vendor does not exist, it will add the info to the table. Write code to demonstrate the procedure works by executing the procedure twice so that it adds a new vendor and then updates that vendor’s information.
  3. Create a view based on the logic you completed in question 1 or 2. Your SQL script should be programmed so that the entire script works every time, dropping the view if it exists, and then re-creating it.
  4. Write a table valued function f_employee_timesheets which when provided an employee_id will output the employee id, name, department, payroll date, hourly rate on the timesheet, hours worked, and gross pay (hourly rate times hours worked).

Written Code

use fudgemart_v3
go

--Question 1
--This runs but doesn't supply correct output
select * from fudgemart_products
select right(product_name, charindex(' ', product_name)) as product_category from fudgemart_products
go


---Runs but returns NULL for product_Category
select product_id, product_name, product_department
from fudgemart_products
order by product_id
declare @product_name as varchar(20)
select right(@product_name, charindex(' ',@product_name)) as product_category

print len(@product_name)


---question 2-----

drop function dbo.f_vendor_sales
go

declare @vendor_id int
set @vendor_id = 1
select count(*) from fudgemart_products where product_vendor_id = @vendor_id
go

--Function says it is completed
create function dbo.f_total_vendor_sales(
   @vendor_id int --input
   ) returns int as
begin
   declare @count int
   set @count = (select count(*) from fudgemart_products.dbo.product_wholesale_price where product_vendor_id = @vendor_id)
   return @count --output
end
go

---When i attempt function, I get invalid object name

select product_vendor_id, product_wholesale_price,
   dbo.f_total_vendor_sales(product_vendor_id) as total_vendor_sales
   from fudgemart_products


----For question 3-------
create procedure p_write_vendor
(
   @vendor_name varchar (50),
   @vendor_phone varchar (20),
   @vendor_website varchar (100)
   ) as
if exists ( select 1 from fudgemart_vendors
               where vendor_name = @vendor_name
               or vendor_phone = @vendor_phone
               or vendor_website = @vendor_website)
   begin
       update fudgemart_vendors
       set vendor_name =@vendor_name,
           vendor_phone = @vendor_phone,
           vendor_website = @vendor_website
       where vendor_name = @vendor_name
       or vendor_phone = @vendor_phone
       or vendor_website = @vendor_website
   end
else
   begin
       insert into fudgemart_vendors values (@vendor_name, @vendor_phone, @vendor_website)
   end

In: Computer Science

Give short answers or Define the following questions [in your own words]: 1. Compare the difference...

Give short answers or Define the following questions [in your own words]:

1. Compare the difference between Attack and Threat.

2. List out 6 different types of attackers

3. Briefly explain 5 different types of vulnerabilities and give examples for each.

4. Explain in brief the different goals of Security.

5. What are the various classes of Threat? Explain in your own words.

6. Briefly explain the principle of Least Privilege with an example scenario.

7. What are fail-safe defaults? Give 3 examples for the same [You are allowed to google to find your examples]

8. Give a brief note about Open design. Give the benefits and disadvantages of Open source code.

9. Why is it required to Separate privileges? Give a brief note on the same.

10. Why do you need to introduce Mandatory vacations for staffs during investigation process?

In: Computer Science

Explain a least 4 kinds of wireless communication subsystems that were used by NASA and SoaxeX...

Explain a least 4 kinds of wireless communication subsystems that were used by NASA and SoaxeX for their recent space expedition

In: Computer Science

Explain the viruses and malware

Explain the viruses and malware

In: Computer Science

In C# creating a math challenge program using +, -, /, * Create a few fields:...

In C#

creating a math challenge program using +, -, /, *

  1. Create a few fields: A readonly array of possible operators, the problem's operator, and each of the two (2) terms

In: Computer Science

Write a menu driven program in Java (OOP) That contain class for Botique. Data members include...

Write a menu driven program in Java (OOP)
That contain class for Botique.
Data members include code ,colour , size ,Quantity
Your class should contains app accessors and mutators method
Your class should contain Parametric and non-parametric constructors (use constructor chaining)
Your class should have input and display method.


In: Computer Science

Write a java program which can randomly generate a permutation of the integer {1, 2, 3,...

Write a java program which can randomly generate a permutation of the integer {1, 2, 3, ..., 48,49,50}. Use the most efficient sorting algorithm to sort the list in an acceding order.

In: Computer Science

Python Coding Question: Find the minimum number of coins that make a given value.

Python Coding Question: Find the minimum number of coins that make a given value.

In: Computer Science