Java HW help

 

Q1: Treasure Cave

Imagine you find a hidden cave filled with with N different types of metal bars
(gold, silver, platinum, steel, etc.) Each type of metal bar has some value
vi, and there are xi bars of that metal in the cave
(for i = 0, 1, 2, 3, … N-1). You want to bring back as many bars as of the
treasure as you can, but your bag can only fit W bars. How do you choose how
many bars of each metal to bring home to maximize the total value?

For example, if your bag can store 7 bars and you have gold, silver, platinum,
and steel in these quantities:

[4, 10, 2, 4] // 4 bars of gold, 10 silver, 2 platinum, 4 steel

and these values

[3, 1, 5, 2]  // gold worth 3 per bar, silver worth 1, platinum 5, steel 2

Then you would want to take this much of each metal

[4, 0, 2, 1]  // all the gold, no silver, all the platinum, 1 steel bar

             // for a total value of 24 (4*3 + 2*5 + 1*2)

Write bestValue() which takes in an integer W, an array of counts, and an
array of values. It should return the best value you can earn by picking the
bars optimally. Your code should run in O(nlogn).

  • Hint #1: This can be done using a Greedy approach.
  • Hint #2: Consider sorting with a custom Comparator

 

Q2. Treasure Cave with Fused Bars–Value

Now assume that for each type of metal, all of the bars are fused together so
that you’re forced to all the bars of a certain type, or none of them.

This means that you sometimes should not take the metal that has the highest
value, because it either will not fit all in your bag (since you have to take
all the bars), or other metals of lesser will be worth more overall value when
combined together.

Write bestValueForFused, which takes in the arguments from above, and returns
the value of the best picks possible.

bestValueForFused(4, [], []) // 0 (the cave is empty)

bestValueForFused(4, [4, 10, 2], [3, 1, 5]) // 12 (take metal 0, even though metal 2 is worth more per bar)

bestValueForFused(4, [4, 2, 2], [3, 2, 5]) // 14 (take metal 1 and metal 2)

bestValueForFused(6, [4, 2, 1], [3, 3, 5]) // 18 (take metal 0 and metal 1)
  • Hint #1: Greedy won’t work here.
  • Hint #2: Start by computing the total value of each metal (i.e. the number
    of bars * value per bar).
  • Hint #3: For each metal, you can either take it or not. If you take it, your
    bag capacity decreases by the corresponding amount. How could you translate this
    idea into a recursive subproblem?

Q3. Treasure Cave with Fused Bars–Picks

This question is optional and worth extra credit.
Write bestPicksForFused(), which solves Q2 but returns an array of bools, where
each element in the array describes whether we picked metal i.

bestPicksForFused(4, [], []) // []

bestValueForFused(4, [4, 10, 2], [3, 1, 5]) // [true, false, false]

bestValueForFused(4, [4, 2, 2], [3, 2, 5]) // [false, true, true]

bestValueForFused(6, [4, 2, 1], [3, 3, 5]) // [true, true, false]

DRIVER CODE :::

 

public class HW7 {

public static void main(String[] args) {
// Q1
   System.out.println(bestValue(7, new int[] {}, new int[] {})); // 0
   System.out.println(bestValue(7, new int[] { 4 }, new int[] { 1 })); // 4
   System.out.println(bestValue(7, new int[] { 4, 10, 2, 4 }, new int[] { 3, 1, 5, 2 })); // 24 [5,3,2,1] //24
   System.out.println(bestValue(7, new int[] { 4, 10, 2, 4 }, new int[] { 3, 3, 5, 2 })); // 25
   System.out.println(bestValue(7, new int[] { 4, 10, 2, 4 }, new int[] { 3, 5, 5, 2 })); // 35

// Q2
   System.out.println(bestValueForFused(4, new int[] {}, new int[] {})); // 0
   System.out.println(bestValueForFused(4, new int[] { 4 }, new int[] { 1 })); // 4
   System.out.println(bestValueForFused(4, new int[] { 4, 10, 2 }, new int[] { 3, 1, 5 })); // 12
   System.out.println(bestValueForFused(4, new int[] { 4, 2, 2 }, new int[] { 3, 2, 5 })); // 14
   System.out.println(bestValueForFused(6, new int[] { 4, 2, 1 }, new int[] { 3, 3, 5 })); // 18
   System.out.println(bestValueForFused(6, new int[] { 4, 2, 1 }, new int[] { 3, 2, 9 })); // 21 (3*4+9*1)

// Q3
   System.out.println(Arrays.toString(bestPicksForFused(4, new int[] {}, new int[] {}))); // []    System.out.println(Arrays.toString(bestPicksForFused(4, new int[] { 4 }, new int[] { 1 }))); // [true]    System.out.println(Arrays.toString(bestPicksForFused(4, new int[] { 4, 10, 2 }, new int[] { 3, 1, 5 }))); // [true, false,false]    System.out.println(Arrays.toString(bestPicksForFused(4, new int[] { 4, 2, 2 }, new int[] { 3, 2, 5 }))); // [false, true, true]    System.out.println(Arrays.toString(bestPicksForFused(6, new int[] { 4, 2, 1 }, new int[] { 3, 3, 5 }))); // [true, true, false]    System.out.println(Arrays.toString(bestPicksForFused(6, new int[] { 4, 2, 1 }, new int[] { 3, 2, 9 }))); // [true,false,true]

}

public static int bestValue(int W, int[] counts, int values[]) {
return 0;
}

public static int bestValueForFused(int W, int[] counts, int values[]) {

}

private static int bestValueForFused(int W, int[] counts, int values[], int MetalIndex) {
}

public static boolean[] bestPicksForFused(int W, int[] counts, int values[]) {
return null;
}
}

 

import java.util.*;

public class MetalBar implements Comparable {

private int value;
private int count;

public MetalBar(int value, int count) {
this.value = value;
this.count = count;
}

public int getValue() {
return value;
}

public int getCount() {
return count;
}

public int compareTo(MetalBar otherBar) {
return Integer.compare(otherBar.value, value);
}

public String toString() {
return String.format(“MetalBar(%d, %d)”, value, count);
}

}

cc-15

 https://www.youtube.com/watch?v=W_O7mziH3vM&ab_channel=DEFCONConference

Review in 500 words or more the video above called Cloud Security Myths.

Physical Security

 

Topic: Complete a Physical Security Assessment (internal and external) of your place of work or living area.  If you use your work area make sure you inform the Security Manager to get permission as to what you are doing. If you live in a gated community inform the security guard of your activities. Refer to your text on the importance of Lighting and Access Control and be sure to cover the salient issues discussed in the text.

Instructions: Please download the Assignment 2 Physical Security Assessment template (MS Word), which is already in APA 7 format, using size 12 Times New Roman font, 1-inch margins, TOC, Headings and Reference page. If you insert images or tables in your report make sure you label them appropriately according to APA. Once completed name your file: YourName_Assignment_2_Physical_Security_Assessment.docx and submit to the appropriate assignment folder. 
Also review any additional files attached for more information.

Application Assignment: Blogs and Defamation

As an avid user of online social media, you identify a very untrue blog written by an anonymous writer. The blog contains many horrible accusations that are unfounded and untrue. After identifying this blog, you feel violated and confused. What steps can you take to have the blog removed? What defamation charges can be filed against the creator of the blog? 

Three Required Headers:

Blog Scenario

Procedure

Defamation Charges 

portfolio project-cloud computing

For this, select an organization that has leveraged Cloud Computing technologies in an attempt to improve profitability or to give them a competitive advantage.  Research the organization to understand the challenges that they faced and how they intended to use Cloud Computing to overcome their challenges.  The paper should include the following sections each called out with a header.

• Company Overview:  The section should include the company name, the industry they are in and a general overview of the organization.
• Challenges: Discuss the challenges the organization had that limited their profitability and/or competitiveness and how they planned to leverage Cloud Computing to overcome their challenges.
• Solution:  Describe the organization’s Cloud Computing implementation and the benefits they realized from the implementation.  What was the result of implementing Cloud Computing?  Did they meet their objectives for fall short?
• Conclusion:  Summarize the most important ideas from the paper and also make recommendations or how they might have achieved even greater success.

Requirements:

The paper must adhere to APA guidelines including Title and Reference pages.  There should be at least three scholarly sources listed on the reference page.  Each source should be cited in the body of the paper to give credit where due.  Per APA, the paper should use a 12-point Time New Roman font, should be double spaced throughout, and the first sentence of each paragraph should be indented .5 inches.  The body of the paper should be 3 pages in length.

Policy, Legal, Ethics

  

1) Do a bit of research on JSON and AJAX. How do they relate to the the Same-Origin policy?

Using WORD, write several short paragraphs on each. A total of 250-300 words. Use your own words.

2) Answer below questions, each of these questions in a paragraph with at least five sentences.Include the question and number your responses accordingly. Min 1 citation for EVERY question and it needs to be referenced. References & citations should be less than 6 years old. They also need to be an academic source something from the library or scholar Google not just any random website. It must be a peer reviewed academic source or an industry recognized type reference. Make sure your citations and your references use proper APA formatting if you are unsure consult the OWL website. 

1. With all the stories about millions and millions of bytes of personal data having been exposed, why is their still any faith at all in the Internet?

2. How has the term hacking changed meaning over the years?

3. What is the most dangerous hacker tool?

4. From the news: How were NSA’s hacker tools  compromised? 

5. What was the vulnerability in the Target Breach?

6. What do you think of hactivism?

7. How did Stuxnet work? 

8. What was the Arpanet?

9. Deep brain stimulation is a treatment for Parkinson’s disease. Medical devices such as these are now becoming accessible through the web. Consider the dangers (threat surface)?

10. What is the Red Team?

11. Make an argument for legalizing the copying of music or software. 

12. Do I or don’t I own the books on my Kindle? If I own them, why can’t I transfer them? If I  don’t own them, what is my legal right to them?

3) Watch this video about Joseph Shumpeter’s concept of Creative Destruction. For example, many think that the introduction of self-driving cars will disrupt the job market for drivers. 

Use at least three sources. Use the Research Databases available from the Danforth Library, not Google.   Include at least 3 quotes from your sources enclosing the copied words in quotation marks and cited in-line by reference to your reference list.  Example: “words you copied” (citation) These quotes should be one full sentence not altered or paraphrased. Cite your sources using APA format. Use the quotes in your paragraphs. Do Not Doublespace.

Copying without attribution or the use of spinbot or other word substitution software will result in a grade of 0.  Write in essay format not in bulleted, numbered or other list format. It is important that you use your own words, that you cite your sources, that you comply with the instructions regarding length of your post. Do not use spinbot or other word replacement software. It usually results in nonsense and is not a good way to learn anything. 

Course project

Gates, co-founder and chairperson of Microsoft Corporation, advocates that in addition to seeking profits, corporations should also become social entrepreneurs in order to help solve social problems. He has called this creative capitalism. Gates argues the desire to help others who are less fortunate should be as powerful a motivator as increasing profits for businesses today.

Review: https://www.gatesfoundation.org/media-center/speeches/2008/01/bill-gates-2008-world-economic-forum

Based on your research you are required to complete a paper answering the following:

  1. Explain free market capitalism.
  2. Describe creative capitalism.
  3. Explain the three advantages of creative capitalism in relation to businesses.
  4. Explain the concept of corporate social responsibility using two examples of socially responsible companies. Clearly and concisely support your examples and explain why these companies are considered socially responsible.
  5. Comment on Gates’ creative capitalism. Do you think that creative capitalism can become the future of capitalism in the U.S.? Justify your response with examples and research.

Requirements:

  • Title Page
  • Intro paragraph
  • Detailed answers for all the questions to be written in 10 – 15 Pages. (Avoid Plagiarism)
  • References (and in text citations) to be APA formatted
  • Use Level One and Level Two headers throughout

emeging-discussion

 

Many business environments have both visible and invisible physical security controls. You see them at the post office, at the corner store, and in certain areas of your own computing environment. They are so pervasive that some people choose where they live based on their presence, as in gated access communities or secure apartment complexes. Alison is a security analyst for a major technology corporation that specializes in data management. This company includes an in house security staff (guards, administrators, and so on) that is capable of handling physical security breaches. Brad experienced an intrusion—into his personal vehicle in the company parking lot. He asks Alison whether she observed or recorded anyone breaking into and entering his vehicle, but this is a personal item and not a company possession, and she has no control or regulation over damage to employee assets. This is understandably unnerving for Brad, but he understands that she’s protecting the business and not his belongings.

When or where would you think it would be necessary to implement security measures for both?

Please make your initial post and two response posts substantive. A substantive post will do at least TWO of the following:

  • Ask an interesting, thoughtful question pertaining to the topic
  • Answer a question (in detail) posted by another student or the instructor
  • Provide extensive additional information on the topic
  • Explain, define, or analyze the topic in detail
  • Share an applicable personal experience
  • Provide an outside source (for example, an article from the UC Library) that applies to the topic, along with additional information about the topic or the source (please cite properly in APA 7)
  • Make an argument concerning the topic.

At least one scholarly source should be used in the initial discussion thread. Be sure to use information from your readings and other sources from the UC Library. Use proper citations and references in your post.

Python Assignment

  airports = [{‘name’: ‘Cincinnati’, ‘altitude’: 2000, ‘code’: ‘CVG’}, {‘name’: ‘Chicago’, ‘altitude’: 1800, ‘code’: ‘OHA’}, {‘name’: ‘Indianapolis’, ‘altitude’: 1700, ‘code’: ‘INY’}]

1. Given the “airports” list above, create 3 lists, one of the airport names, one of the airport altitudes and one of airport codes using for loops… using list comprehensions…using another technique

2. Given the 3 lists from #1, combine them back into a list of dictionaries using the most efficient technique you can think of

3. Given the “airports” list above, find the total combined altitude using for loops… using the sum() function… using the reduce() function.

PLEASE PROVIDE PYTHON 2.X/3.X CODE FOR SOLVING THE EXERCISES ABOVE.