(Duplicate Elimination) Use a one dimensional array to slove the following problem. Read 20 numbers, each of which is 10 and 100, inclusive. As each number is read, print it only if it's not a duplicate of a number already read. Provide for the "worst case" in which all 20 numbers are different. use the smallest possible array to slove this problem.
Add the following functionality to your solution. Sort the array in ascending order and print the elements of the sorted array.
if you could please explain each line of the code that would be wonderful.
In: Computer Science
For each of the following statements, state whether the statement is true or false AND justify your answer.
In: Computer Science
Question 4
4.1. Explain each of the ways data can be inputted into a programming environment. (10)
4.2. Discuss each step in the requirements analysis phase of programming. (20)
In: Computer Science
In Python: Program. At the university, passwords for the campus computer system must meet the following requirements:
Start by translating the pseudocode below into a python function. Add the last two requirements to your function.
In: Computer Science
Write a Java program that defines two boolean variables a and b and shows that regardless of the values of a and b, the expressions (a && (a || b)) and a are always the same.
In: Computer Science
Using any existing 2D or 3D graphics library ( such as Java 2D, Java 3D or OpenGL ) draw a scene featuring various elements. You are to choose from one of the following categories:
3. Any visual landscape element of your choice (Using OpenGL with Java or Python )
You are free to create whatever you choose but it must conform to the following guidelines.
In: Computer Science
1. In the command fprintf within the string statement what operator executes a linefeed?
() (4 points).
A. \n B. \l C. \d D. /n
2. To multiply two arrays element-by-element, what operator must you use? ( ) (4 points).
A. + B. * C. .* D. ./
3. The default base of log function in MATLAB is ( ) (4 points).
A. e B. 2 C. 10 D. 5
4. Which one of the following is a valid placeholder in an fprintf statement ( ) (4
points).
A. %d B. %n C. %p D. %r E. %v
5. Which of the following names is NOT a valid name for a user-defined function? ( )
(4 points).
A. Poker B. Bla4jack C. Solitare8 D. Card-Pickup
6. If mathematical expressions are written in MATLAB without required parentheses,
operations start from left to right in order. (True or False) ( ) (4 points).
7. A MATLAB code is saved with .m extension while functions are saved with .f
extension. (True or False) ( ) (4 points).
8. Every variable used in a MATLAB code appears in the workspace until they are
cleared. (True or False) ( ) (4 points).
9. MATLAB automatically puts comments in our codes when we create codes and save
them in an M-File. (True or False) ( ) (4 points).
10. A function must return numerical outputs. (True or False) ( ) (4 points).
11. Write commands to generate a 3x5 array containing random numbers between 1 to 21 and then assign this array to A. Transpose A and assign to B. Sort the rows of B based on the 2nd column in a descending order and assign it to C. (15)
12. Write commands to create the following graph using the following parameters. All the elements in the graph must be addressed by commands. (20
-? < ? < ?
Y=sin(?),
Z=log(?).
13. According to the trajectory line (below), the height(m) y=v0sin(?)t-gt2/2. Given the initial velocity is 2 m/s, please write a user-defined function to calculate the initial ? degree, and write commands to test your function program to calculate ? in degree when height=0.0786 m and t=0.2 s. (25)
In: Computer Science
How do we separate end-users security policies from the infrastructure security policies on the windows server?
In: Computer Science
Computer Architecture:
Write a MIPS program to compute f = g - (f + 5)
Assume registers $to, $s1 hold values for g and f
respectively.
The program should display the following prompts and read value
entered by the user “Enter a value for f:"
“Enter a value for g:"
The program the prints: "Answer for f = g - (f + 5):"
The program should repeat the above steps 3 times for each input
pair, f and g
Make certain that your assembly code is properly organized (indented, commented, contains your name at the top of the code). Comment any assumptions at the top and include results showing the working code via screen prints
In: Computer Science
1. The community college you work for would like to
get a security test performed, explain the different test types and
the advantages and disadvantages of them
.2. The community college now wants to have a security company come
in and perform security tests. Explain what they should expect
before, during, and after the testing.
In: Computer Science
You have been hired by a home security company to design and implement a home alarm system. The logic of the system is as follows: once the alarm system has been armed, it is to sound if the front door is opened, the back door is opened or either of two windows is opened (you can assume there are only two windows).
Design the necessary circuit to implement the situation described above. Your circuit should have five inputs (A = alarm, F = front door, B = back door, W1 = window 1 and W2 = window 2). A = 1 means the system is armed; A = 0 means it is disarmed. F = 1 means the front door is open; F = 0 means it is closed. (Similarly for the back door and the windows.) There should be one output, S. When S = 1 the alarm should sound; S = 0 means the alarm is silent. Please use these letters to indicate the inputs and the output so all projects are consistent.
Be CAREFUL to get the correct function for your five inputs before simplifying and designing the circuit. You should minimize the circuit. Your inputs and output should be labeled. You should submit a Microsoft Word document including the following items while ensuring that everything is laid out in a manner that is easy to follow (portrait or landscape is acceptable):
• Your name in the top left
• Drawing of your completed circuit including all appropriate labels.
You will need to practice your MS Word drawing, layering, and object management skills.
See below for common logic gate objects that can be reused in your document.
• Truth tables for the circuit (use Word table feature)
• Kmap for the circuit (use Word table feature)
• Details (show your work) on what was done to simplify the circuit
• A brief written summary (250 to 500 words) of the process you followed, decisions made in laying out the circuit, etc..
In: Computer Science
Climbing Stairs
Bibi climbs stairs of a multi-leveled building. Every time Bibi climbs a set of stairs, she counts the steps starting from 1 to the number of steps in that particular set of stairs while climbing the stairs. For example if she climbs two set of stairs, the first containing 5 steps and the second containing 3 steps, she will say 1, 2, 3, 4, 5, 1, 2, 3 and the total number of steps would be 8. Find the number of steps that Bibi climbed in each set of steps.
Format Input:
The first line of the input contains an integer N, the number of numbers Bibi said. The second line of the input contains N integers Ai , the i-th number Bibi said. The given sequence of Ai will be a valid sequence, that means the whole input can be cut into sequences of 1, 2, . . . , X, where X is the number of steps in a set of stairs.
Format Output:
Print the number of steps that Bibi climbed for each set of steps, in the order of the input sequence, separated by single spaces. There is no leading and trailing spaces in the output.
Constraints
• 1 ≤ N ≤ 1, 000
• 1 ≤ Ai ≤ 1, 000
• The given sequence of Ai will be a valid sequence, that means the whole input can be cut into sequences of 1, 2, . . . , X, where X is the number of steps in a set of stairs.
Sample Input 1 (standard input):
8
1 2 3 4 5 1 2 3
Sample Output 1 (standard output):
5 3
Sample Input 2 (standard input):
10
1 2 1 1 2 3 4 1 2 3
Sample Output 2 (standard output):
2 1 4 3
Sample Input 3 (standard input):
5
1 2 3 4 5
Sample Output 3 (standard output):
5
Note The first sample is the example from the problem description.
In the second sample:
The first set of stairs have 2 steps, current sequence is ”1, 2”
second set have 1 steps, current sequence is ”1, 2, 1”
third set have 4 steps, current sequence is ”1, 2, 1, 1, 2, 3, 4”
last set have 3 steps, current sequence is ”1, 2, 1, 1, 2, 3, 4, 1, 2, 3”, just like the input
In the third sample, there is only one set of stairs which contains 5 steps.
*Note: Use C language and long long int (must be the same as the constraint)
In: Computer Science
Create a SavingsAccount class to store data of savers (account
holders). Your class should match the following
specifications.
1. Each instance of the class contains a private data member
savingsBalance indicating the amount the saver currently has on
deposit, saver’s name, saver’s CNIC, account number (this has to be
unique) and a member to store saver status (if savingsBalance >
10000 then status changes to gold otherwise silver).
2. Class also has a data member annualInterestRate to store the
annual interest rate which will be the same for all the
savers.
3. Implement a default constructor with minimum savingsBalance of
100, and other fields as well. Also create a parameterized
constructor if a customer wants to open an account with a different
starting balance.
4. Provide member function calculateMonthlyInterest that calculates
the monthly interest by multiplying the savingsBalance by
annualInterestRate divided by 12; this interest should be added to
savingsBalance.
5. Provide a recursive member function turnInToGold that returns
the number of months a saver need to become gold member
6. Provide a member function modifyInterestRate that sets the
annualInterestRate to a new value.
7. Provide a function that returns the total number of account
holders with the bank.
8. Write main() to test class SavingsAccount . Instantiate two
different objects of class SavingsAccount, s1 and s2, with balances
of $2000.00 and $3000.00, respectively. Set the annualInterestRate
to 3 percent. Then calculate the monthly interest and print the new
balances for each of the savers. Then set the annualInterestRate to
4 percent, calculate the next Month’s interest and print the new
balances for each of the savers. Also print the months it will take
for both to become gold savers of bank.
In: Computer Science
Write a Java program which takes a String representing an arithmetic expression as an input and displays whether or not the expression is balanced. If the expression is not balanced (i.e. the wrong # of parentheses or in the wrong order) it will display an error message. For Example: Input an expression: ( ( 2 + 4 ) * 2 ) Expression is balanced Input an expression: ( 5 * 7 – 6 ) ) Error: Expression is not balanced.... Implement a stack calculator using both a numbers and operations stack. Be sure to check that the expression is balanced before running it through the calculator.
In: Computer Science
Analyze the current trends of software crisis in a specific industry in relation to software engineering principles, concepts and methodology
In: Computer Science