3. Suppose you buy 100 shares of a stock at $12 per share, then another 100 at $10 per share, and then sell 150 shares at $15. You have to pay taxes on the gain, but exactly what is the gain? In the United States, the FIFO rule holds: You first sell all shares of the first batch for a profit of $300, then 50 of the shares from the second batch, for a profit of $250, yielding a total profit of $550. Write a program that can make these calculations for arbitrary purchases and sales of shares in a single company. The user enters commands buy quantity price, sell quantity price (which causes the gain to be displayed), and quit. Hint: Keep a queue of objects of a class Block that contains the quantity and price of a block of shares.
Q: this assignment is going to be checked on Moss deduction ! could help me please? There are two…
A: Given :- There are two main systems for measuring distance, weight and temperature, the Imperial…
Q: Write a program that gets a starting value from the user and then printsthe Syracuse sequence for…
A: "Since you have not mention any programming language, so we will write our program in C language."…
Q: The language we are using here is in Racket. Please try tying each of the following (car '(11 12…
A: What do car and cdr do? That last line of the above should cause an error. Explain why the single…
Q: Draw the CFG of the following example and write four test paths of the following example. for (int…
A:
Q: Suppose we can buy a chocolate bar from the vending machine for $1 each.Inside every chocolate bar…
A: Solution: Note : Since it is not mentioned what has to be calculated and which programming language…
Q: In Python: You have exchange rates from one currency to another USD -> BTC [some value]. Use a list…
A: In Python: You have exchange rates from one currency to another USD -> BTC [some value]. Use a…
Q: Show the string that would result from each of the following string for-matting operations. If the…
A: Given: Show the string that would result from each of the following string for-matting operations.…
Q: Task: Write a C++ program using variables and loops in order to implement the Hi-Low strategy of…
A: #include <iostream> using namespace std; int main() { // Variable that stores the correct…
Q: Write a Python program, that determines the solution of the equation by using the False Position…
A: Code is given below :
Q: Write a c program that calculates a degree classification such that number of modules used for the…
A: ALGORITHM:- 1. Take input for the marks of 10 subjects from user. 2. Calculate the total of all the…
Q: 6: opposites = {'up': 'down', 'right': 'wrong', 'true': 'false'} alias = opposites print(alias is…
A: Note: According to the company's policy, I am allowed to answer only three subparts of multiple…
Q: Write a program in C++ to handle the following scenario: Following is a list of tablets available in…
A: Arrays are utilized to hold multiple values in a single variable. Syntax of declaring an array :…
Q: QUESTION 3 Let F(x.y): "x is friend with y", N(x): "x is funny", W(x): "x is 'wise", R(x): "x is…
A: The solution for the above given question is given below:
Q: Suppose you save $100 each monthin a savings account with annual interest rate 3.75%. The monthly…
A: Since, programming language is not mentioned in the question, we will answer this question in Java…
Q: Create a program in the JAVA language to read the values of the variable U, P, and V and then print…
A: Java program for the given scenario is provided in the below .
Q: How do you model the following situation with use case diogram: The lab director does a lab test…
A: Extend is used when a use case conditionally adds steps to another first class use case. Include is…
Q: Jsing dynamic programming with the items ordered as listed (i.e., do not sort), v What is B[k=2,w=3]…
A: Here we fill the data using the Tabular method .…
Q: A project currently underway at Chemical Labs, Inc requires that a substance be continued ally…
A: Answer python program import time def main():on_flag = True # set the thermostat flag True means…
Q: Write a Java program for all the concepts of Mutual Exclusion by using the following options. ▪…
A: Concept of Mutual Exclusion: Communicate thread using sharing access to field and field will…
Q: Write a program OrderCheck.java that takes four int command-line arguments w, x, y, and z. Define a…
A: Code Screenshot :
Q: JAVA, include pseudo code* Mexico population is 130,000,000 and it grows 1.37% per year. US…
A: I have given java code with output below.
Q: Given P[0..100) of int, determine whether the first 10 values in P are a copy of the last 10 values…
A: Given, P[0..100) of int To determine whether first 10 values in P are copy of last 10 in p we will…
Q: Write a java program to read and store four student's name and their CGPA, sort them into an order…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Write a simple program that takes in a numerator and denominator and then computes the GCD for that…
A: import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner…
Q: Suppose you can buy chocolate bars from a vending machine for $1 each. Inside every chocolate bar is…
A: Write a test program in C++that would allow the user to enter amount of dollars and then use the…
Q: A proposition Q follows from a proposition P, if Q is never false when P is true. Suppose we want to…
A: A proposition Q follows from a proposition P, if Q is never false when P is true. Suppose we want to…
Q: Knowing that (x + 1)2 = x2 + 2x + 1,and that multiplication is more time consuming than addition,…
A: A natural number is the positive number start from 1 till infinity. They are used for simple…
Q: The following program is designed to echo a message from one child process to another, with upper…
A: The issue is here: ORIGINAL PROGRAM GIVEN IN QUESTION #include<stdio.h>…
Q: Write a FORTRAN90 program that reads a student ID and his GP he program should print a message…
A: 1- In this assignment require, two input studentID, GPA, and display output according to them using…
Q: Based on the previous example, write a script to produce the following plot RAN
A: We need to use the initial commands to compose t,x,y, and z and polt the figure as shown in the…
Q: In one pass, Train A can start from the source station at time T[0], halt at each station for h unit…
A: The code is given below
Q: Display following menu given below. Enter p for Panadol Enter d for Disprin Enter c for Calpol Enter…
A: Editable Code in C++ :- #include <iostream> using namespace std; int main() { //Menu…
Q: Five members of an obesity club want to know how much they have lost or gained weight since the last…
A: Note: As mentioned in the question, vector is used instead of arrays. Creating 2-d vector:…
Q: My book. ., because someone split .milk on it A. Is ruined B. Will be ruined C. Was ruined D. Are…
A: We normally use will to speak about the future.
Q: What is the length of the following list? Equivalently, if the list below was assigned to the…
A:
Q: Dreamworld is known for his uniqueness and there are 2 different denomination coins in Dreamworld,…
A: Please find the code below:
Q: I need help with a Java Project. Create a Java program that will allow a user to book a plane…
A: Flight booking While OTAs and metasearch engines are the preferred option at the search stage, the…
Q: Write a java program to read set of student names from the command line argument. And sort the names…
A: java program to read a set of student names from the command line argument. And sort the names in…
Q: write a c program Count Dracula buys blood from the public. But since he prefers certain types to…
A: Given The answer is given below.
Q: I need to write a Java program that takes the names and grades of students and outputs their name,…
A: Here our task is to calculate z-score and letter grade for each of the student of the list entered…
Q: Deduce a Java program for the concept of Mutual Exclusion by using the following options. ▪…
A: Concept of Mutual Exclusion: Communicate thread using sharing access to field and field will…
Q: Write a c++ program for a bank in your town that updates its customers’ accounts at the end of each…
A: Objective: This program implements the Bank account problem in which the user inserts values for his…
Q: Write a C program: In a class of n students print the total no. of female students and total no. of…
A: Code: #include <stdio.h>int main(){ //declaring required variables int n1,n2,total;…
Q: (Intro to Python) 4. fruit = "orange" print(len(fruit)) Group of answer choices 5 6 4 none of…
A: GIVEN: (Intro to Python) 4. fruit = "orange" print(len(fruit)) Group of answer choices 5 6 4…
Q: As we in general, try to solve the problem first; we start with a brute force, simple, algorithm:…
A: Coded using Python 3.
Q: The 'get()' method in the 'Producer-Consumer' problem code, written as below, is incorrect (shown in…
A: Updated code for getting method in producer and consumer problem is given below.
Q: A project currently underway at Chemical Labs, Inc requires that a substance be continued ally…
A: Algorithm: Get this temperature.Repeat the subsequent steps as long because the temperature is…
Q: Implement the following if-elif-else-nested-if conditions. Create a program that asks the user the…
A: # taking input from user and convert it to lower case fullyVac = input("Are you fully vaccinated ?…
Q: In this section, you are to implement a trapdoor knapsack encryption scheme. When the programis run,…
A: Answer is given below .
Q: write a program that creates as many child processes as the value of x. For each process, you must…
A: In this solution we write a program that creates as many child processes as the value of x (say…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- Write a program (Java, C) which the following 4 password breaking cases are implemented. The password file should contain 6-digit numbers only (from 000000 to 999999) and assume that the attacker knows that. MD5 pre-implemented open-source hash algorithm should be used. If applicable, For each case what Alice’s password is, what the salts are (if you use random text generator, you need to provide the range only). Test your program and make sure that you break the target passwords in every case. Add a wild guess for the time you break the target password(s) for every case. Case I: Trudy wants to determine Alice's password. Trudy does not use her dictionary 256/2 255 expected work Case II: Trudy wants to determine Alice's password. Trudy uses her dictionary If Alice's password is in the dictionary - 219 Else - 255 Total 1/4(219)+3/4 (255) ≈ 254.6 Case III: Trudy wants to determine any of the 1024 password in the file. Trudy does not use her dictionary If passwords were hashed…You are given the following boolean function as input for SAT: (x1∨x2∨x3¯∨x4∨x5¯)∧(x1∨x4¯∨x5) You apply the transformation from class to get an input of 3-SAT. The resulting boolean formula has how many clause and how many variables?Substitution ciphers are encryption/decryption algorithms that replace one letter or number with another. The first attested use of a substitution cipher in military affairs was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). In caesar cipher , you replace each letter by 3rd letter on. If it is out of bound (later than Z), then round to the head (letter A) and continue the shift. For example:meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB Please write a program in Java to implement the Caesar Cipher: a. Implement the encryption algorithm. Ask the user to input one all lower case normal sentence (called plaintext) using the nextLine method, and then output the encrypted text (called ciphertext). b. Implement the decryption algorithm. Ask the user to input one encrypted sentence (i.e. ciphertext) using the nextLine method, and then output the decrypted text (i.e. plaintext).
- Write a program that performs the brute-force attack to break the password. The following table shows encrypted passwords using the crypt() function. Your mission is to break the password corresponding your CWID in the table. For example, the last digit of your CWID is 1, then you should identify the plaintext password for indBOW06MoVz6. Last digit of CWID Encrypted password 1 indBOW06MoVz6 2 in79RsnfG/VWo 3 inbqJM0dLgWvo 4 incT1ji3YqQ/Y 5 in7haMV00ylgk 6 in1U0tb9WpIcI 7 inPlXS.yNKivQ 8 inqidvfWapJp2 9 injY7hdQJTeu2 0 inQW.HgtuEe. Last digit of CWID Encrypted password 1 indBOW06MoVz6 2 in79RsnfG/VWo 3 inbqJM0dLgWvo 4 incT1ji3YqQ/Y 5 in7haMV00ylgk 6 in1U0tb9WpIcI 7 inPlXS.yNKivQ 8 inqidvfWapJp2 9 injY7hdQJTeu2 0 inQW.HgtuEe. i want answer for 2nd oneWrite a program in java that forms a green square inside a JPanel. Once you press space, the square should move from one side to the other horizontally (for example from left topto the right top).When the square hits the edge of the Panel, it should move the negative direction to reach to the other side. The square must be updated using a Runnable and therefore,make sure that it is utilizing concurrency properly. You know that you need to override the method run, coming from a Runnable to implement basic concurrency.Another trick, when the user presses S key, a new square is created and they move simultaneously (as they are concurrent objects). Make sure they don't stand on top of eachother; change their Y coordinates a bit to make the other squares a bit lower in the screen. We should be able to create 5 squares in your environment. Beyond 5, you shouldprevent creation of additional squares.kindly do it ASAP Write a code to implement the combination of RSA and AES algorithms. In your implementation, first the RSA will be used to encrypt the secret key for sending from Alice to Bob. On the other hand, the AES will be used for encryption and decryption of long messages between the Alice and Bob. Remember in such type of combination, first the Bob will generate its public and private keys and share its public key with the Alice. The Alice encrypt the short message (secret key for communicating the long messages) using RSA and send it to the Bob. Then Bob decrypts the short message (secret key for communicating the long messages) using its private key and found the short message (secret key for communicating long messages). After that both Alice and Bob use this same secret key for the encryption and decryption of long messages.
- You are given a list of projects and a list of dependencies (which is a list of pairs ofprojects, where the second project is dependent on the first project). All of a project's dependenciesmust be built before the project is. Find a build order that will allow the projects to be built. If thereis no valid build order, return an error.EXAMPLEInput:projects: a, b, c, d, e, fdependencies: (a, d), (f, b), (b, d), (f, a), (d, c)Output: f, e, a, b, d, cShow the derivation of the asymptotic run time, O(n), for each of the following methods. You may use the text highlighting technique shown in class, or list the individual Java statements along with the number of times each is executed as a function of the input size, n. public static void checkerboard(int n){ for (int row = 0; row < n; row++) { for (int col = 0; col < n; col++){ if ((row+col)%2 == 0) { // Print a single hashtag System.out.print("#"); } else { // Print a single space System.out.print(" "); } } // Complete the line System.out.println(); } }Answer the questions(?) from the following code Mov al, 2 Sub al, 1 (al=? ZF=?) sub al, 1 (al=? ZF=?) mov al, 0FFh Inc al ( al=? ZF=? CF=?) Inc al (al=? ZF=?) Mov al, 1000,0011b Add al, 1001,0100b (AL=? PF=?) SUB al, 0100, 0000b (Al=? PF=?).
- Write a postcondition for the following in Guarded Command Language (G.C.L): 1. Given P[0..100) of int, determine whether the first 10 values in P are a copy of the last 10 values in P.In Python, Solve the locker riddle which reads as follows:Imagine 100 lockers numbered 1 to 100 with 100 students lined up in front of those 100lockers:The first student opens every locker.The second student closes every 2nd locker.The 3rd student changes every 3rd locker; if it’s closed, she opens it; if it’s open, she closes it.The 4th student changes every fourth locker (e.g., 4th, 8th, etc.).The 5th student changes every 5th locker (e.g., 5th, 10th, etc.).That same pattern continues for all 100 students. Which lockers are left open after all 100 students have walked the rowof lockers?Extend the implementation of blackjack to work with multiple decks. This involves creating several decks and then executing the same logic, as mentioned previously, for the blackjack game. Note that with multiple decks, it’s possible to get multiple copies of the same card. For example, a player may get a hand consisting of (‘clubs’, 2), (‘clubs’, 2), and so on. Further extend the implementation of blackjack with cheat decks (or missing cards); that is, create decks with known missing cards and ensure that the blackjack logic still works. For example, it should be possible to create decks consisting entirely of Aces and picture cards. This would drastically increase the number of times either player has a hand consisting of a value of 21. Create a “card counting” scheme to keep track of the running count. First, you will need to extend the game logic to create a discard pile. The discard pile contains all the cards that have been used in the previous hands and starts off empty.…