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
Use nested for loops statements to generate the following output. (Java)
-----1
---22
--333
4444
Ignore the dashes formatting wouldnt allow for extra spaces behind the numbers
In: Computer Science
Create a C program that will test the following
:
Theory (0-70): 65
Laboratory (0-30): 25
Total Marks: 90
In: Computer Science
One student has designed a new transport-layer protocol, NTLP, that is completely different from the TCP or UDP. He then creates a packet that has a physical-layer header, a data-link-layer header, and an IP header. This packet contains the NTLP header and the application data payload. The packet is sent to the destination IP address as indicated in the IP header. Will this packet be delivered to the destination IP address indicated in the IP header? Please justify your answer.
In: Computer Science
Consider the following reference string:
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1
Find the number of Page Faults with FIFO, Optimal Page Replacement, and LRU with four free frames that are initially empty. Which algorithm gives the minimum number of page faults?
In: Computer Science
1.Consider a two-way communication between John and Jane in which both want to exchange messages privately over a network. A third party, Tom wants also wants to know what messages are being exchanged between John and Jane. Explain what specific type of cybersecurity attack describes Tom’s malicious intentions of intercepting the private exchanges between John and Jane and how it can be carried out without being detected
In: Computer Science
Write a C++ main program that has the following:
9. Display all printable characters of the ASCII table in 3
columns: first column: 32-63, second column: 64-95, third column:
96-127. Each column must include the numeric value and the
corresponding character. Following is an example of one of 32 rows
in the ASCII table:
33 ! 65 A 97 a
In: Computer Science
1.Explain the security risks of devices with Remote Desktop access enabled
In: Computer Science
DO NOT ANSWER THIS[1. Write a program named filemaker.py that will be used to store the first name and age of some friends in a text file named friends.txt. The program must use a while loop that prompts the user to enter the first name and age of each friend. Each of these entries should be written to its own line in the text file (2 lines of data per friend). The while loop should repeat until the user presses Enter (Return on a Mac) for the name. Then, the file should be closed and a message should be displayed. See Sample Output. SAMPLE OUTPUT Enter first name of friend or Enter to quit Denny Enter age (integer) of this friend 24 Enter first name of friend or Enter to quit Penny Enter age (integer) of this friend 28 Enter first name of friend or Enter to quit Lenny Enter age (integer) of this friend 20 Enter first name of friend or Enter to quit Jenny Enter age (integer) of this friend 24 Enter first name of friend or Enter to quit File was created] DO NOT ANSWER THIS
Code for the above program
fp = open("friends.txt", "w")
firstname = input("Enter first name of friend or Enter to quit ")
while firstname!="":
age = int(input("Enter age (integer) of this friend "))
print(firstname, file=fp)
print(age, file=fp)
firstname = input("Enter first name of friend or Enter to quit ")
fp.close()
print("File was Created")
the QUESTION IN PYTHON
Now write a program named filereader.py that
reads and displays the data in friends.txt. This program should
also determine and print the average age of the
friends on file. That will require an accumulator
and a counter. Use a while loop to process the
file, print the data, and modify the accumulator and counter. Then
close the file and display the average age accurate to one
decimal place. See the Sample Output..
SAMPLE OUTPUT
My friend Denny is 24
My friend Penny is 28
My friend Lenny is 20
My friend Jenny is 24
Average age of friends is 24.0
In: Computer Science
Struct PERSON Assignment
Outcomes:
Program Specifications:
DESIGN and IMPLEMENT a program that will CREATE and use three different variables of type PERSON.
Create a struct using the typedef command for a DATE.
Create a struct for a PERSON with the following fields.
Create three variables of type PERSON. Create a function that populates the data for each person (all 3 of them). Create a function that outputs all data about each of the people in a nice formatted manner.
Data Validation:
All dates entered must be validated. Make sure you account for the number of days in each month, the fact that there are exactly 12 months and every four years there is a leap year.
The name for each PERSON will be stored in sentence case.
The gender will either be M, F, or O.
The annual income will between 0 dollars and 1 million dollars.
Submission Requirements:
Requirements will be same as the first assignment which will be the same for all future assignments except that you do NOT NEED a design tool for this assignment.
DO NOT:
In: Computer Science
Shapes2D
Write the following four classes to practice using an abstract class and polymorphism. Submit all four classes.
Shape2D class
For this class, include just an abstract method name get2DArea() that returns a double.
Rectangle2D class
Make this class inherit from the Shape2D class. Have it store a length and a width as fields. Provide a constructor that takes two double arguments and uses them to set the fields. Note, the area of a rectangle is the length times the width.
Circle2D class
Also make this class inherit from the Shape2D class. Have it store a radius as a field. Provide a constructor that takes a double argument and uses it to set the field. Note, the area of a circle is PI times it's radius times it's radius.
Shape2DDriver class
Have this class provide a method named displayArea() that takes an object from just any of the above three classes (you can't use an Object type parameter). Have the method display the area of the object, rounded to one decimal place.
Also the code should Enforce an abstract get2DArea() method and the right parameter type for displayArea()
Executes the following code:
Shape2DDriver tester = new Shape2DDriver();
Rectangle2D r = new Rectangle2D( 2, 3 );
Circle2D c = new Circle2D( 4 );
tester.displayArea( r );
tester.displayArea( c );
In: Computer Science
1.Create full program in Java that will simulate a Rock Paper Scissors Game You will create the code so that when the program is run the user will see in the console the following: We are going to play rock paper scissors. Please choose 1 for Rock 2 for Paper or 3 for scissors. The program will have your choice which is the integer-valued typed in by the user and compChoice which will be the randomly generated value of either 1 2 or 3. You will test all the ways the user wins if he or she beats the computer using || with if and then you will check all the ways that computer could win using else if with || and lastly the only other thing that can happen would be a tie if both choices are the same for the default else. Display what was chosen and what was randomly chosen by the computer and who wins or if there is a tie. For extra credit, you can use dialog boxes and show images.
In: Computer Science