Questions
How would you make the shell script MyScript.sh a standalone executable (i.e. avoid to use source)?

How would you make the shell script MyScript.sh a standalone executable (i.e. avoid to use source)?

In: Computer Science

Define a problem with user input, user output, While Statement and some mathematical computation. Write the...

Define a problem with user input, user output, While Statement and some mathematical computation. Write the pseudocode, code and display output.

In: Computer Science

Develop a flowchart for ONE of the processes below and discuss the non-value added activities, bottlenecks,...

Develop a flowchart for ONE of the processes below and discuss the non-value added activities, bottlenecks, duplication or delays. Make recommendations to improve the process.

  • Registration for classes
  • Financial aid or loan application
  • Making an auto purchase
  • Making a purchase on Internet
  • Registration to a hospital
  • Organize an event or a party

In: Computer Science

Find article about (Implementing DHCP) Included with the summary must be a source notation providing the...

Find article about (Implementing DHCP)

Included with the summary must be a source notation providing the following information:

-Name of the Article

-Author

-Source information (Publication Name, URL, Article publish date)

In: Computer Science

Write a function int strlen(char s1[]) which returns the length of the char array s1.

Write a function int strlen(char s1[]) which returns the length of the char array s1.

In: Computer Science

Problem Title : Magical Cave Lili, a great magician, has a mission to enter a cave...

Problem Title : Magical Cave

Lili, a great magician, has a mission to enter a cave to get treasure inside. The cave only has 1 path without branches. But the cave is not safe because there are some traps inside that can reduce Lili’s life points. But in addition to traps, the cave also has potions that can increase Lili’s life points. Before entering the cave, Lili casts magic that can reveal all the traps and potions inside the cave. But before entering the cave, Lili must prepare her life points first because in the cave because Lili cannot use her magic to add life points or destroy the traps. What is the minimum life point that Lili must prepare so that her life point is always positive during the trip inside the cave.

Note: if Lili's point drops to 0 or negative before entering and during the trip inside the cave, then Lili is declared dead.

Format Input

There are T test cases. Each testcase contains an integer N which represents the length of the cave. On the next line there are N numbers represents the value of trap and potion. Traps are marked with numbers that are negative and potions are marked with numbers that are positive.

Format Output

Output T line with format “Case #X: ”, where X represents the testcase number and Y represents the initial life points that Lili has to prepare.

Constraints

  • 1 ≤ T ≤ 100
  • 1 ≤ N ≤ 5000
  • −108 ≤ Ai ≤ 108, which Ai is the value of each traps and potions.

Sample Input & Output (standard input & output)

2
5
1 2 -3 4 -5
Case #1: 2
5
-1 -1 -1 -2 9
Case #2: 6

Explanation
In case 1, the minimum life points that Lili must prepare is 2. With a simulation like the following.
At position 1, Lili’s life point increased by 1 to 3.
At position 2, Lili’s life point increased by 2 to 5.
At position 3, Lili’s life point is reduced by 3 to 2.
At position 4, Lili’s life point increased to 4 to 6.
At position 5, Lili’s life point is reduced by 5 to 1.
In each position Lili’s life points are Positive so the answer is Valid. if the initial life
prepared by Lili is 1, then Lili will die in fifth position with a life point of 0.

In: Computer Science

Java question: Write a method printCombinationR(int[] array, int r) that generates and prints all possible combinations...

Java question: Write a method printCombinationR(int[] array, int r) that generates and prints all possible combinations of r elements in array of size n,. For example, if input array is {1, 2, 3, 4} and r is 2, then output should be {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4} and {3, 4}.

I kind of know how to write this with DFS with four or five formal parameters, however I don't know how to solve it after the formal parameters are restricted by only using (int[] array, int r).

In: Computer Science

Write the script in python to carry out the z- normalization on "Salary", if the Mean...

Write the script in python to carry out the z- normalization on "Salary", if the Mean is 79.6 and standard deviation is 14.4152. Assume the data is read from a csv file titled "Comp_sal_2014.csv".

In: Computer Science

When logged in as the root user, how often would you do the command rm -rf...

When logged in as the root user, how often would you do the command rm -rf / ?

In: Computer Science

Discuss the types of distribution transparency as they may benefit to various business contexts. Provide illustrative...

Discuss the types of distribution transparency as they may benefit to various business contexts. Provide illustrative examples.

Database Management Question

In: Computer Science

What are the major drawbacks of static allocation? How does a hybrid allocation scheme consisting of...

What are the major drawbacks of static allocation? How does a hybrid allocation scheme consisting of static allocation, stack-based allocation, and heap based allocation solve the problem

In: Computer Science

0,101 x 22 to Scientific notation

0,101 x 22 to Scientific notation

In: Computer Science

Java 2D Drawing Application. The application will contain the following elements: a) an Undo button to...

Java 2D Drawing Application.

The application will contain the following elements:

a) an Undo button to undo the last shape drawn.
b) a Clear button to clear all shapes from the drawing.
c) a combo box for selecting the shape to draw, a line, oval, or rectangle.
d) a checkbox which specifies if the shape should be filled or unfilled.
e) a checkbox to specify whether to paint using a gradient.
f) two JButtons that each show a JColorChooser dialog to allow the user to choose the first and second color in the gradient.
g) a text field for entering the Stroke width.
h) a text field for entering the Stroke dash length.
I) a checkbox for specifying whether to draw a dashed or solid line.
j) a JPanel on which the shapes are drawn.
k) a status bar JLabel at the bottom of the frame that displays the current location of the mouse on the draw panel.

If the user selects to draw with a gradient, set the Paint on the shape to be a gradient of the two colors chosen by the user. If the user does not chose to draw with a gradient, then Paint with a solid color of the 1st Color. The following code can create a gradient paint object:
Paint paint = new GradientPaint(0, 0, color1, 50, 50, color2, true);

To set the stroke for a line to be drawn, you can use the following code:

            if (dashCheckBox.isSelected())
            {
                stroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10, dashLength, 0);
            } else
            {
                stroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
            }

Where the first stroke line creates a dashed line and dashLength is a one element float array with the dash length in the first element. The second stroke line creates an undashed line with the line width specified from the GUI.

Note: When dragging the mouse to create a new shape, the shape should be drawn as the mouse is dragged.

A template project has been provided for you in Canvas in Java2DDrawingApplicationTemplate.zip. This project contains a MyShapes hierarchy that is a complete shape hierarchy for drawing a line, rectangle or oval. You must use this MyShapes hierarchy. A template for the Drawing Application Frame is also provided along with a template for the DrawPanel inner class. You do not need to use these templates if you so choose.

In the paintComponent(Graphics g) method of the DrawPanel, to loop through and draw each shape created by the user, you will loop through an ArrayList of MyShapes, that you built, and call the draw(Graphics2D g2d) method for each shape. The draw method is already implemented in the MyShapes hierarchy.

Note: You do not need to create an event handler for each component in the top two lines of the frame. You only need to create event handlers for the buttons. You can get the values out of all the other components in the top two lines, when the user presses the mouse button on the DrawPanel. At that time, you have all the information you need to create a new Myshapes object.

Note: Do not use the NetBeans GUI generator for this assignment.

-------------------------------------------------------------------- PLEASE USE THE FOLLOWING FILES!!! -----------------------------------------------------------------------

https://drive.google.com/file/d/1wiRjRNrunGPYMeWD2qM7Zgj6H0jg_SAa/view?usp=sharing

Thank you!

In: Computer Science

The verticies of ABC are A(2,4), B (7,6) and C(5,2) give the correct composition of the...

The verticies of ABC are A(2,4), B (7,6) and C(5,2) give the correct composition of the matricies for the image of ABC after the given composition of the transformations in the order listed(show what it would be for each vertex)

First Translation: (x, y) -> (x-2,y-3)

Second Rotation: 75 degrees about the pivot popoint (1,3)

In: Computer Science

C++ Programming The following program reads the sentences in "fdata.txt" and stores each word in a...

C++ Programming
The following program reads the sentences in "fdata.txt" and stores each word in a word vector starting with the first letter.
Fill in the blanks.

#include "pch.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>


using namespace std;

class SVector
{
public:
int size;
int idx;
char x;
string *sptr;
// (a)
void insert(string s);
void print();
};

SVector::SVector(char c, int size)
{
x = c;
idx = 0;
this->size = size;
//(b)
}
void SVector::insert(string s)
{
//(c)
}
void SVector::print()
{
if(idx != 0){
cout << "starting with " << x << endl;
for(int i = 0; i < idx; i++){
cout << sptr[i] << endl;
}
}
}

int main()
{
SVector *sv[26];
string word;
ifstream fin;
fin.open(".\\data\\fdata.txt");
//cout << fin << endl;
if(!fin){
cout << "file not opened" << endl;
return 0;
}

for(int i = 0; i < 26; i++){
char c = 'a' + i;
sv[i] = //(d);
}

while(true){
fin >> word;
if(fin.eof()) break;
int fc = //(e);
sv[fc]->insert(word);
}

for(int i = 0; i < 26; i++){
sv[i]->print();
}
  
return 0;
}

In: Computer Science