USING JAVA
Almost sort the array using Merge Sort. Perform Merge Sort as usual except that during the final merge, it is not necessary to merge all n elements, but only the elements in positions 1 to k.
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
Write a Java program to do the following:
Specifics:
Write an application that prompts a user for two integers and displays every integer between them. Display a message if there are no integers between the entered values.
Make sure the program works regardless of which entered value is larger. Save the file as InBetween.java.
Don’t forget to create the application/project InBetweenTest.java Class that has the main method and an object to use the InBetween class.
In: Computer Science
1.Describe the problem at IFG as succinctly as you can. Use this description to identify the main stakeholders. 2. IFG can’t afford the resources to identify, define, cleanse, and validate all of its data. On the other hand, building yet another data mart to address a specific problem worsens the data situation. Propose a solution that will enable IFG to leverage a key business problem/opportunity using their BI tools that does not aggravate their existing data predicament. Please provide 3-4 refernces and 800 words of answers for both questions. No plagiarism please.
In: Computer Science
c++
Redefine CDAccount from Display 10.1 so that it is a class rather than a structure. Use the same member variables as in Display 10.1 but make them private. Include member functions for each of the following: one to return the initial balance, one to return the balance at maturity, one to return the interest rate, and one to return the term. Include a constructor that sets all of the member variables to any specified values, as well as a default constructor. Embed your class definition in a test program.
10.1 display
#include <iostream>
3 using namespace std;
4 //Structure for a bank certificate of deposit:
5 struct CDAccount
6 {
7 double balance;
8 double interestRate;
9 int term; //months until maturity
10 };
11
12
13 void getData(CDAccount& theAccount);
14 //Postcondition: theAccount.balance and
theAccount.interestRate
15 //have been given values that the user entered at the
keyboard.
16
17
18 int main( )
19 {
20 CDAccount account;
21 getData(account);
22
23 double rateFraction, interest;
24 rateFraction = account.interestRate / 100.0;
25 interest = account.balance * rateFraction * (account.term /
12.0);
26 account.balance = account.balance + interest;
27
28 cout.setf(ios::fixed);
29 cout.setf(ios::showpoint);
30 cout.precision(2);
31 cout << "When your CD matures in "
32 << account.term << " months,\n"
33 << "it will have a balance of $"
34 << account.balance << endl;
35 return 0;
36 }
37
38 //Uses iostream:
39 void getData(CDAccount& theAccount)
40 {
41 cout << "Enter account balance: $";
42 cin >> theAccount.balance;
43 cout << "Enter account interest rate: ";
44 cin >> theAccount.interestRate;
45 cout << "Enter the number of months until
maturity\n"
46 << "(must be 12 or fewer months): ";
47 cin >> theAccount.term;
48 }
In: Computer Science
Find the usage and the required counter measures to avoid effects of the below tool.
A). Metasploit
answer in approx 5 pages.
In: Computer Science
1. Write a Python program to: ask the user to enter two integers: int1 and int2. The program uses the exponential operator to calculate and then print the result when int1 is raised to the int2 power. You also want to calculate the result when int1 is raised to the .5 power; however, you realize that it is not possible to take the square root of a negative number. If the value for int1 that is entered is a negative number, print a message to the user explaining why you cannot complete the task. Otherwise, calculate the square root and print it. Finish the program by printing the values of int1 and int2.
2. For problem # 1, when the user entered a negative number, you output a message that it was not possible to take the square root of a negative number. This time you will write a Python program that asks the user to enter a non-negative number (float). If the user does enter a negative number, you will use a while loop to continue prompting the user until you get a valid number (i.e. a number >= 0). Once the user enters a valid number, you calculate and print the square root. Test your program twice, once using a negative number and once using a non-negative number. I JUST NEED ANSWER FOR QUESTION 2 ONLY........... Thank you
In: Computer Science
How to decrypt the cipher encrypted by the algorithm showed as below when clearText and key are not given:
def encrypt(cleartext, key):
to_return = bytearray(len(cleartext))
for i in xrange(len(cleartext)):
to_return[i] = ord(cleartext[i]) ^ ord(key[i % len(key)])
return str(to_return)
In: Computer Science
Please solve in C++ only
class is not templated
You need to write a class called LinkedList that implements the following List operations:
public void add(int index, Object item);
// adds an item to the list at the given index, that index may be
at start, end or after or before the
// specific element
2.public void remove(int index);
// removes the item from the list that has the given index
3.public void remove(Object item);
// finds the item from list and removes that item from the list
4.public List duplicate();
// creates a duplicate of the list
// postcondition: returns a copy of the linked list
5.public List duplicateReversed();
// creates a duplicate of the list with the nodes in reverse order
// postcondition: returns a copy of the linked list with the nodes in
6.public List ReverseDisplay();
//print list in reverse order
7.public Delete_Smallest();
// Delete smallest element from linked list
8.public List Delete_duplicate();
// Delete duplicate elements from a given linked list.Retain the earliest entries.
9 Make a function that adds a linked list to itself at the end.
Input:
4 -> 2 -> 1 -> NULL
Output:
4 -> 2 -> 1 -> 4 -> 2 -> 1 -> NULL
note : code should work on Visual studio 2017 and provide screenshot of output
In: Computer Science
It is difficult to make a budget that spans several years, because prices are not stable. If your company needs 200 pencils per year, you cannot simply use this year’s price as the cost of pencils two years from now. Because of inflation, the cost is likely to be higher than it is today. Write a program to gauge the expected cost of an item in a specified number of years. The program asks for the cost of the item, the number of years from now that the item will be purchased, and the rate of inflation. The program then outputs the estimated cost of the item after the specified period. Have the user enter the inflation rate as a percentage, such as 5.6 (percent). Your program should then convert the percent to a fraction, such as 0.056 and should use a loop to estimate the price adjusted for inflation.
In: Computer Science
In: Computer Science
For VBA:
Complete this problem on Sheet1.
The user will select a cell on Sheet1 and input a positive number (you do not know which cell will be selected ahead of time). This cell automatically becomes the active cell. Next, create a macro named problem1 that will perform the following tasks:
• Obtain the value in the active cell and store it in a variable.
• In the cell to the right of the original active cell, output 5 plus the value in the original active cell
• In the cell above the original active cell, output one-half the value in the original active cell
• In the cell below the original active cell, output the square root of the value in the original active cell
Create a run button on Sheet1 that executes problem1.
Your macro must work for any positive number input into any cell. For example, if you type 36 in cell B3 and then click the run button, the number 41 will appear in C3, the number 18 will appear in B2, and the number 6 will appear in B4. Then if you click on cell D5, type 25, and click the run button, the number 30 will appear in E5, the number 12.5 will appear in D4, and the number 5 will appear in D6.
You can assume the user will not input the value in the first or last row, nor the last column (Think about what will happen if the value is input into one of those cells. Or better yet, try doing it and see what happens.).
Assume the user will input a value in the active cell before clicking the run button.
Use the Option Explicit statement for this macro and in all future macros that you create. This will force you to declare your variables.
Hint: When the run button is clicked, whatever cell is selected at that time automatically becomes the active cell. You can move to the right, above, and below the active cell by using relative references in your program. This will require you to use ActiveCell.Offset() three times.
PLEASE take screenshots of VBA code and excel. Thank you
In: Computer Science
NOTE: PLEASE READ THE FIRST 4 GUIDELINES ON DOING THIS ASSIGNMENT
IT'S A C++ CLASS, THE FUNCTIONS ARE PROVIDED BELOW
Assignment 7.1 [45 points]
No initial file comment is required for this assignment. Function comments are still required.
Implement the following functions. Each function deals with null terminated C-Style strings. You can assume that any char array passed into the functions will contain null terminated data. Place all of the functions in a single file and then (in the same file) create a main() function that tests the functions thoroughly. You will lose points if you don't show enough examples to convince me that your function works in all cases.
Please note the following:
You can do anything you want to test the functions, as long as the end result is that you demonstrate that they work correctly.
You may not use any variables of type string. This means that you should not #include <string>. Also, you may not use any c-string functions other than strlen(). If you use any other c-string functions, you will not get credit. Note, however, that functions such as toupper(), tolower(), isalpha(), isspace(), and swap() are NOT c-string functions, so you can use them. Also note that this prohibition is only for the functions that you are assigned to write. You can use whatever you want in your main() function that tests the assigned functions.
In most cases it will be better to use a while loop that keeps going until it hits a '\0', rather than using a for loop that uses strlen() as the limit, because calling strlen() requires a traversal of the entire array. You could lose a point or two if you traverse the array unnecessarily.
None of these function specifications say anything at all about input or output. None of these functions should have any input or output statements in them. The output should be done in the calling function, which will probably be main(). The only requirement about main() is that it sufficiently test your functions. So, you can get user input in main() to use as arguments in the function calls, or you can use hard-coded values -- up to you, as long as the functions are tested thoroughly.
Here's a hint about how to work with c-strings in main(). There are several different ways that you could assign values to c-string variables, but I think the easiest is just hardcoding a lot of examples. For example:
char str1[] = "Hello World"; char str2[] = "C++ is fun!";
Whatever you do, don't try to create and initialize a c-string on one line using pointer notation, like this:
char* str1 = "Hello world";
This is dangerous (and officially deprecated in the C++ standard) because you haven't allocated memory for str1 to point at.
Since it is just being used for testing, In this case it is fine to have a very long main() function.
Here are the functions:
This function finds the last index where the target char can be found in the string. it returns -1 if the target char does not appear in the string. The function should be case sensitive (so 'b' is not a match for 'B').
int lastIndexOf(const char* inString, char target)
This function alters any string that is passed in. It should reverse the string. If "flower" gets passed in it should be reversed in place to "rewolf". For efficiency, this must be done "in place", i.e., without creating a second array.
void reverse(char* inString)
This function finds all instances of the char 'target' in the string and replace them with 'replacementChar'. It returns the number of replacements that it makes. If the target char does not appear in the string it should return 0.
int replace(char* inString, char target, char replacementChar)
This function returns true if the argument string is a palindrome. It returns false if it is no. A palindrome is a string that is spelled the same as its reverse. For example "abba" is a palindrome. So are "hannah" and "abc cba".
Do not get confused by white space characters, punctuation, or digits. They should not get any special treatment. "abc ba" is not a palindrome. It is not identical to its reverse.
Your function should not be case sensitive. For example, "aBbA" is a palindrome.
You must solve this problem "in place", i.e., without creating a second array. As a result, calling your reverse() function from this function isn't going to help.
bool isPalindrome(const char* inString)
This function converts the c-string parameter to all uppercase.
void toupper(char* inString)
This function returns the number of letters in the c-string.
int numLetters(const char* inString)
In: Computer Science
This basic problem is a practical application of if-statement(s).
Write a function called bolt_check that takes one scalar input argument and returns one scalar output argument. The input represents the measured length of a machine screw during the quality-assurance phase of its manufacturing. The purpose of the function is to categorize the measured length into one of six categories. If the measured length is within two percent of one of its five nominal lengths-- 3/8, 1/2, 5/8, 3/4, or 1 (inch), then the nominal length is returned. Otherwise 0 is returned, signifying that the bolt failed the test. You may find that the built-in function abs for absolute value is useful for this problem.
You may submit your work as many times as you want. Try to get 100%!
This basic problem is a practical application of if-statement(s).
Write a function called bolt_check that takes one scalar input argument and returns one scalar output argument. The input represents the measured length of a machine screw during the quality-assurance phase of its manufacturing. The purpose of the function is to categorize the measured length into one of six categories. If the measured length is within two percent of one of its five nominal lengths-- 3/8, 1/2, 5/8, 3/4, or 1 (inch), then the nominal length is returned. Otherwise 0 is returned, signifying that the bolt failed the test. You may find that the built-in function abs for absolute value is useful for this problem.
You may submit your work as many times as you want. Try to get 100%!
This basic problem is a practical application of if-statement(s).
Write a function called bolt_check that takes one scalar input argument and returns one scalar output argument. The input represents the measured length of a machine screw during the quality-assurance phase of its manufacturing. The purpose of the function is to categorize the measured length into one of six categories. If the measured length is within two percent of one of its five nominal lengths-- 3/8, 1/2, 5/8, 3/4, or 1 (inch), then the nominal length is returned. Otherwise 0 is returned, signifying that the bolt failed the test. You may find that the built-in function abs for absolute value is useful for this problem.
You may submit your work as many times as you want. Try to get 100%!
This basic problem is a practical application of if-statement(s).
Write a function called bolt_check that takes one scalar input argument and returns one scalar output argument. The input represents the measured length of a machine screw during the quality-assurance phase of its manufacturing. The purpose of the function is to categorize the measured length into one of six categories. If the measured length is within two percent of one of its five nominal lengths-- 3/8, 1/2, 5/8, 3/4, or 1 (inch), then the nominal length is returned. Otherwise 0 is returned, signifying that the bolt failed the test. You may find that the built-in function abs for absolute value is useful for this problem.
You may submit your work as many times as you want. Try to get 100%!
This basic problem is a practical application of if-statement(s).
Write a function called bolt_check that takes one scalar input argument and returns one scalar output argument. The input represents the measured length of a machine screw during the quality-assurance phase of its manufacturing. The purpose of the function is to categorize the measured length into one of six categories. If the measured length is within two percent of one of its five nominal lengths-- 3/8, 1/2, 5/8, 3/4, or 1 (inch), then the nominal length is returned. Otherwise 0 is returned, signifying that the bolt failed the test. You may find that the built-in function abs for absolute value is useful for this problem.
You may submit your work as many times as you want. Try to get 100%!
This basic problem is a practical application of if-statement(s).
Write a function called bolt_check that takes one scalar input argument and returns one scalar output argument. The input represents the measured length of a machine screw during the quality-assurance phase of its manufacturing. The purpose of the function is to categorize the measured length into one of six categories. If the measured length is within two percent of one of its five nominal lengths-- 3/8, 1/2, 5/8, 3/4, or 1 (inch), then the nominal length is returned. Otherwise 0 is returned, signifying that the bolt failed the test. You may find that the built-in function abs for absolute value is useful for this problem.
You may submit your work as many times as you want. Try to get 100%!
This basic problem is a practical application of if-statement(s).
Write a function called bolt_check that takes one scalar input argument and returns one scalar output argument. The input represents the measured length of a machine screw during the quality-assurance phase of its manufacturing. The purpose of the function is to categorize the measured length into one of six categories. If the measured length is within two percent of one of its five nominal lengths-- 3/8, 1/2, 5/8, 3/4, or 1 (inch), then the nominal length is returned. Otherwise 0 is returned, signifying that the bolt failed the test. You may find that the built-in function abs for absolute value is useful for this problem.
You may submit your work as many times as you want. Try to get 100%!
This basic problem is a practical application of if-statement(s).
In matLab: Write a function called bolt_check that takes one scalar input argument and returns one scalar output argument. The input represents the measured length of a machine screw during the quality-assurance phase of its manufacturing. The purpose of the function is to categorize the measured length into one of six categories. If the measured length is within two percent of one of its five nominal lengths-- 3/8, 1/2, 5/8, 3/4, or 1 (inch), then the nominal length is returned. Otherwise 0 is returned, signifying that the bolt failed the test. You may find that the built-in function abs for absolute value is useful for this problem.
You may submit your work as many times as you want. Try to get 100%!
In: Computer Science
Create a flowchart for the following:
Mr. Arthur Einstein, your college physics teacher, wants a program for English-to-Metric conversions. The program should be able to convert from kilometers to miles, kilograms to pounds, and liters to quarts. The program should first determine the type of conversion desired. To do this, the user will enter a letter indicating the type of measurement: pounds (P), miles (M), and quarts (Q). After doing this, the program should proceed to read the appropriate metric value and convert it to the correct imperial value. Use the following conversion factors:
1 kilometer = 0.621388 miles
1 kilogram = 2.2046 pounds
1 liter = 0.877193 quarts
In: Computer Science