You need to determine the kind of class a particular variable is. How can you determine this? How can you determine its identifier?
Explain the operations performed and their order in evaluating the following expression, and give the result of that evaluation. -- var = -8.0 + 3.0 * 4.5 – 2.0 / 33.0
Write a statement that assigns the integer portion of a floating point variable named wraps to wholewraps as a floating point variable.
Show by a Python code example how to load the Python math library and then determine the square root of the variable gross.
In: Computer Science
C++ programming question
theNumbers.txt
144 + 26
3 * 18
88 / 4
22 – 8
16 / 2
20 * 20
-Your Program should read in all items, compute the answer to each expression (any decimals should be rounded to the nearest tenth), and output the answers to an output file of the user's choosing. The formatting of the output is that there is a set width of 10 characters for each answer, left aligned, with a new line character every 3 answers. A sample “answers.txt” is provided below. (not drawn to scale)
answers.txt
17000 54 22
14 8 400
-You may assume that the name of the text file that will be outputted to is always 20 characters or less.
-You may assume that there are only 4 possible operations ( + - * /), add, subtract, multiply, and decimal division, and that no other characters will show up as the middle symbol.
- Appropriate error messages should be displayed if the file cannot be opened.
- Extra Credit: The answers in the output file ONLY show a decimal if the answer is not a whole number answer.
In: Computer Science
Using python, please complete these 4 exercises. Please limit your code to these skills:
For loop
While loop
Input function
F strings
Tuples
Lists
Nested ifs
Elias
Exercise 1
Using the following list, do the following:
[15, 70, 15, 38, 49, 98, 62, 89, 2, 21, 40, 74, 36, 36, 65, 1, 55, 16, 24, 56]
Exercise 2 (1 Point):
Using the following list, do the following:
1. Iterate through each element in the list
2. Print out whether the element is positive or negative or zero on a new line for each element.
[-2, 1, -2, 7, -8, -5, 5, 10, -6, 7]
Exercise 3 (2 Points):
Create a new list using the range function, appending the values from the range function's output into the list.
The range function must:
Hint: Use either a for loop or a list comprehension
Exercise 4 (6 Points):
In this exercise, you will be required to do the following:
Take the following phrase: The only thing we have to fear is fear itself
So, the end result should be:
Hetay onlyway hingtay eway avehay otay earfay isway earfay itselfway
In: Computer Science
Briefly write about your thoughts about Freedom of Speech on the Internet.
In: Computer Science
Can you think of a way that Excel can be used unethically and give an example?
Your answer must be a minimum of 2 paragraphs, no spelling errors, and complete sentences.
In: Computer Science
Which of the case studies that you read (Walmart, Target or 5 Big Data Industries) caught your attention and why? Before reading the articles, did you think about data being used in the manner that it is? Name one other organization that may be using data warehousing and data mining techniques and explain how it is being used. Or explain how after years of collecting data how the data in the Academic Database that was implemented in Modules 6 and 7 can be useful to the academic institution? Explain your answer in 100 to 150.
In: Computer Science
1.It is acceptable to let some else use your MSDSQ120 account if you are working close by in the lab. True or False
2. If I am a performing technical review on a plate map and I do not see a designated area for signature/initial and date, then the following is true: (choose the best response)
A. the plate map is exempt from my technical review
B. I only need to email the Originator of the plate map and say " I review the plate map"
C. I can apply my signature and date to the form.
D. I can apply my signature, date, and meaning of signature as "Reviewer" so that the purpose of my signature and date is clearly identify .
E. None of the above.
3. While in the lab, data should be recorded... ( Choose the best response)
A. On a scrap paper, then neatly written on the worksheet at the of the day.
B. Analyst should remember what happened in the lab with the assay and then record data at their desk.
C. While at the bench at the time each step is completed on the correct batch record.
4. Which examples below are acceptable format to document the date and time ( Choose best response)
a. 27Nov2020
b. 27Nov20
c. Nov 3, 2020
d. Nov3rd, 2020
e. January 3, 2020
f. All of the above
5. True or False : The date has been corrected according to Good Document Practices
(05Dec15) EE KAJ O6Dec15
6. True or False: We should record all data according to ALCOA documentation standards.
7. True or False : Recording data contemporaneously means that as long as it is recorded sometime during the day is acceptable.
8. True or False: Any pen is acceptable to use to record raw data as long as it is blue or black ink.
9. True or False : The date has been corrected according to Good Document Practices
(05Dec15) or 06Dec15EEKAJ 06Dec15
In: Computer Science
Show the major steps for computing X9 in “ADD X9, X10, X11” for the given values. Please indicate if there is an overflow and show the final content of X9 as a hexadecimal number. a) X10=0xCFFFFFFF and X11=0xC0000000 b) X10=0xCFFFFFFF and X11=0xA0000000
In: Computer Science
Convert 2.115 single-precision floating point binary format. Please show every single detail for upvote. Please do not answer otherwise.
In: Computer Science
Under normal conditions, commercial aircraft generally rise at
about 1,000 to 2,000
feet per minute (this is called the rate of climb) after take-off,
until they reach a
cruising altitude of 35,000 feet. Design the logic for a program
that allows the user to
enter the rate of climb as input, and then for every minute after
take-off until the
aircraft has reached cruising altitude, outputs the minute number,
and the height of the
plane after that minute. After that the program must output the
number of minutes that
have elapsed since take off, and the height at which the plane is
cruising (this may not
be exactly 35,000 feet).
In: Computer Science
Convert -10.5 single-precision floating point binary format.
Please show every single detail for upvote.
Please do not answer otherwise.
In: Computer Science
Task: Read the case study below and answer the following
questions.
Case Study: The Reveton Ransomware Attacks
In August 2012, the Internet Crime Complaint Center (IC3), a
partnership between the FBI and the National White Collar Crime
Center, was inundated with reports of a new type of cybercrime.
Victims across the United States reported that while searching the
Internet, their computers locked up, and they received the
following message, purportedly from the FBI: “This operating system
is locked due to the violation of the federal laws of the United
States of America! (Article 1, Section 8, Clause 8; Article 202;
Article 210 of the Criminal Code of U.S.A. provides for a
deprivation of liberty for four to twelve years.)” The message then
accused the victim either of visiting pornography Web sites or of
distributing copyrighted content. Victims were told they could
unlock their computers and avoid prosecution by paying a fine of
$200 within 72 hours of receiving the message. The message came
replete with the official FBI logo.
The incident pointed to a steep rise in ransomware attacks.
Ransomware is malware that disables a computer or smartphone until
the victim pays a fee, or ransom. Unlike other viruses, the Reveton
version of ransomware is not activated by opening a file or an
attachment. Rather it is an example of “drive-by malware,” viruses
that download automatically when a user visits an infected Web
site.
The FBI immediately issued an alert, but within a month,
cybersecurity experts had identified 16 variants of the ransomware.
These viruses had infected 68,000 unique IP addresses. It is
estimated that on an average day, about 170 victims paid the $200
fee and received valid unlock codes. The compromised computers
could not be fixed through the installation or updating of
antivirus software because the computer was locked. Because so many
home PC owners fail to back up their systems regularly, many
victims faced losing a significant amount of data. The $200 fee
itself was low enough to encourage payment. A visit to a
professional IT service to repair the damage could potentially cost
the same amount and take more time to resolve. A quick payment
through a prepaid money card system, such as MoneyPak, could save
the victim a lot of trouble.
The United States was not the first country to be hit by these
attacks. In early 2012, criminal gangs targeted France, Germany,
and the United Kingdom. Ransomware attacks first broke out in
Russia in 2009. Since that time, they have spread to almost every
country on the globe, hitting the United States and Japan
especially hard. Symantec, an IT security company, estimates that
gangs are extorting over $5 million per year from online victims.
The rise of ransomware attacks is, no doubt, due in part to their
success. In France, for example, almost 4 percent of victims
coughed up the ransom money during a non-Reveton scam.
The Reveton ransomware is delivered by the popular Russian-language
Citadel malware toolkit. The latest version of Citadel can also
grab passwords from Web browsers and change Web sites to trick
users into handing over their login information.
In December 2012, the United Kingdom arrested three people they
believed were involved in the Reveton ransomware attacks. Finding
the perpetrators, however, is unusual and is not the most effective
way to combat this crime. Law enforcement agencies and IT security
companies have urged the public to take measures to prevent
themselves from falling victim to such attacks—by keeping software
such as Java, Acrobat Reader, Adobe Flash, Windows, and their
browser software updated. An early Reveton ransomware attack made
use of a vulnerability in a version of Java that had just been
patched a month prior. Computer users can also avoid infections by
using security software that identifies suspicious Web sites, and
by not clicking online ads from dubious companies. Perhaps,
however, the best way to avoid the spread of these attacks is to
encourage victims to report the crime and to refuse to comply with
the ransom demands.
Questions for the Homework
1-Why are ransomware attacks on the rise?
2-What can you do to prevent ransomware attacks on your own
computer?
3-How do you think victims should respond to ransomware attacks?
4-Do the victims have an ethical obligation to future victims? If
yes, why? If no, why?
In: Computer Science
From a processors’ point of view, why is it important to know when the critical moisture content is reached?
In: Computer Science
You are to create a class called ManageDB. The ManageDB class will have a
2 input constructor
that has the following definition:
ManageDB(int number, String fileName)
The constructor will create an array of EmployeeDB objects of length
"number".
The constructor will read the file located at "fileName" and extract the
information from that
file to populate a database of EmployeeDB objects. The file contains
information on the
EmployeeDB objects. This information is contained in records.
The format of each record is as follows:
^ "index of employee" "name of field" = "value of field"
Each record will start with a '^' character.
The "index of employee" is always a 4 character field representing a
positive integer.
The "name of field" is the name of the field to be populated for a
EmployeeDB object.
There is a delimiter between the "name of field" and the "value of field"
which is '='.
The "value of field" is the character string representing the value of the
field specified in "name of field".
The valid "name of field" strings are:
"age"
"name"
"salary"
For each "name of field" the "value of field" will be of the following
type:
age - integer
name - String
salary - double
An example of a valid record is as follow:
^0002age=24
This record would set the 0002 indexed EmployeeDB object age to 24.
You can assume that a record is formatted correctly. That is there will
always be a ^, =, and a valid
"name of field". However, the "index of employee" may not have a valid
number (either out of range or
not a number). The "value of field" may also be invalid if a number is
specified. The name
"value of field" will always have a valid String value (there are no
errors for this field).
If there is an error in the "index of employee" or the "value of field"
portion then ignore the
record and decode the next record. If the "index of employee" portion is
out of range then ignore that
record.
The EmployeeDB class is provided for you. Use the EmployeeDB class to
create the EmployeeDB array and track
the information for each Employee.
You need to create 3 public methods for the ManageDB class.
public String getName(int i) // returns the name of Employee at i index
public int getAge(int i) // returns the age of Employee at i index
public double getSalary(int i) // returns the salary of Employee at i
index
Compile your program with the EmployeeDB class and the DBTester class
which are both supplied to you.
Your program must run to completion and pass all the test cases. Make sure
to handle all exception
that might occur so your program can successfully run. The file to read is
called "EmployeeData.txt"
which is provided to you. Place this file in the working directory of your
project (the base directory
of your package).
Add your name to the DBTester.java file at the top so your name is
displayed.
Capture a screen image of the program ouput with your name and the result
of the test cases.
Files provided:
EmployeeDB.java
DBTester.java
EmployeeData.txt
------------------------
public class DBTester
{
public static void main(String args[ ])
{
System.out.println("Homework 4 test case results by Your Name");
ManageDB m = new ManageDB(5, "EmployeeData.txt");
boolean result;
int testCount = 1; // used to track test numbers
result = isSame(23, m.getAge(0));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
if (m.getName(0).equals("Jane"))
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(1000000.98, m.getSalary(0));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(-1, m.getAge(1));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
if (m.getName(1).equals("Jerry"))
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(100000, m.getSalary(1));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(29, m.getAge(2));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
if (m.getName(2).equals("Joann"))
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(50000.8, m.getSalary(2));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(-1, m.getAge(3));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
if (m.getName(3).equals(""))
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(-1, m.getSalary(3));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(25, m.getAge(4));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
if (m.getName(4).equals("John"))
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
result = isSame(1177.22, m.getSalary(4));
if (result == true)
System.out.println("Test Case " + testCount + " Passed");
else
System.out.println("Test Case " + testCount + " Failed");
testCount++;
}
private static boolean isSame(double x, double y)
{
double error = .00001;
boolean rv = false;
if (((x + error) >= y) && ((x - error) <= y))
{
rv = true;
}
return rv;
}
}
-----------------------------
employeedata.txt
^0000age=23^0000name=Jane^0000salary=1000000.98^0005age=20^0005name=Joe^00
05salary=11888.22^0002age=29^0002name=Joann^0002salary=50000.8
^00a1age=36^0001name=Jerry^0001salary=100000^0004age=25^0003age=3q2^0004sa
lary=1177.22^0w03name=Joan
^0004name=John^0003salary=100a00a
----------------------------
class EmployeeDB
{
// Member variables
private int age;
private String name;
private double salary;
// Constructors
public EmployeeDB()
{
age = -1;
name = "";
salary = -1.0;
}
// Mutators
public void setName(String n)
{
name = n;
}
public void setAge(int a)
{
age = a;
}
public void setSalary(double s)
{
salary = s;
}
// Accessors
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
public double getSalary()
{
return salary;
}
}
In: Computer Science