public class IntNode
{
private
int data;
private
IntNode link;
public
IntNode(int data, IntNode link){.. }
public
int getData(
) {.. }
public
IntNode getLink(
) {..
}
public
void setData(int data)
{.. }
public
void setLink(IntNode link) {.. }
}
All questions are based on the above class, and the following declaration.
// Declare an empty, singly linked list with a head and a tail reference.
// you need to make sure that head always points to the head
node and tail always points to the tail node.
IntNode head,
tail;
head = tail =
null;
// 1.) Insert a node with data 2 into this empty list
// 2.) Insert a node with data 4 at the end of the list.
// 3.) Insert a node with data 3 between the first and the last node.
// 4.) Insert a node with data 1 before the first node.
// 5.) delete the node with data 2
// 6.) delete the node with data 1
In: Computer Science
1. Explain the important areas that need to be considered for a
migration of web or mail services to the cloud. Why are these areas
important?
2. The cloud computing model can lead to privacy compliance
concerns. Provide examples of these concerns, and an analysis of
the types of actions that you might take to mitigate these
concerns.
5. What cloud computing best practices would you propose adopting?
Why?
In: Computer Science
SUBJECT: CYBER ESSENTIALS
Convert between binary and hexadecimal values
|
Question 7: Convert binary number to a hexadecimal number |
|
Binary number: 00001100 |
|
Hexadecimal value: ?? |
|
Question 8: Convert binary number to a hexadecimal number |
|
Binary number: 01001111 |
|
Hexadecimal value: ?? |
|
Question 9: Convert binary number to a hexadecimal number |
|
Binary number: 10101101 |
|
Hexadecimal value: ?? |
|
Question 10: Convert hexadecimal number to an 8 bit binary number |
|
Hexadecimal number: AB |
|
8 bit binary number: |
|
Question 11: Convert hexadecimal number to an 8 bit binary number |
|
Hexadecimal number: D2 |
|
8 bit binary number: ?????????? |
|
Question 12: Convert hexadecimal number to an 8 bit binary number |
|
Hexadecimal number: 01 |
|
8 bit binary number: ?????????? |
Part 3: ASCII Code (10 points)
|
Question 13: What character is the hexadecimal ASCII code 23? |
|
Question 14: What character is the hexadecimal ASCII code 4A? |
|
Question 15: What character is the hexadecimal ASCII code 6A? |
Part 4: Converting numbers to binary (20 points)
Question 16: For each scenario determine if the numbers should be stored as ASCII codes or binary equivalents. Then find the ASCII code or calculate the binary equivalent.
|
Scenario |
ASCII code |
Binary equivalent |
|
The course number: 107 |
||
|
The year: 2001 |
||
|
The number of printers in inventory: 62 |
||
|
The weight of a suitcase when it is checked in at the airport: 24 |
Question 17: Explain your reason for each of the choices in the previous question.
|
Scenario |
Binary equivalent |
|
The course number: 107 |
|
|
The year: 2001 |
|
|
The number of printers in inventory: 62 |
|
|
The weight of a suitcase when it is checked in at the airport: 24 |
In: Computer Science
Write a Reverse Polish Calculator, RPN in JAVA
Each time an operand is encountered, two values are popped from this stack, the given operation is performed, and the result is pushed back onto the stack. Utilize Java generic Stack Class to implement this algorithm with four arithmetic operations: +, *, -, /.
Implement a class RPN with a single static method evaluate. This method should have the following signature:
public static String evaluate(String expression)
It should split the passed expression into (a string array of) tokens by invoking split method of String class. This array can then be processed one element at a time (perhaps another method): each time a number is found – it is pushed on a stack. Each time an operation is found – two numbers are popped from the stack, the given operation is performed, and the result is pushed back on the stack. If the passed expression was a properly formed RPN, the last element on the stack represents the result. It should be returned as a string. If the given expression is not valid, evaluate should return a string denoting a syntax error.
Your main should continually ask the user to input a potential RPN string which would be passed to the evaluate method. In order to terminate the procedure, the user would input an empty string (carriage return).
Sample run of how it should look:
run:
Enter an RPN expression or to exit
2 3 4 +
7.0
extra junk ignored
Enter an RPN expression or to exit
2 3 4 + *
14.0
Enter an RPN expression or to exit
2 3 + +
Syntax error
Enter an RPN expression or to exit
10 6 1 - /
2.0
Enter an RPN expression or to exit
5 4 3 / /
3.75
Enter an RPN expression or to exit
good bye
In: Computer Science
Create an application that calculates and displays the starting and ending monthly balances for a checking account and a savings account.
Welcome to the Account application Starting Balances Checking: $1,000.00 Savings: $1,000.00 Enter the transactions for the month Withdrawal or deposit? (w/d): w Checking or savings? (c/s): c Amount?: 500 Continue? (y/n): y Withdrawal or deposit? (w/d): d Checking or savings? (c/s): s Amount?: 200 Continue? (y/n): n Monthly Payments and Fees Checking fee: $1.00 Savings interest payment: $12.00 Final Balances Checking: $499.00 Savings: $1,212.00.
void deposit(double amount)
The Withdrawable interface should include this method:
void withdraw(double amount)
And the Balanceable interface should include these methods:
double getBalance()
void setBalance(double amount)
sorry to bother i really appreciate the help could you explain step by step please and thank you.
In: Computer Science
############callbacks
##def function_1( x ) : return x ** 2
##def function_2( x ) : return x ** 3
##def function_3( x ) : return x ** 4
##
###### create a list of callbacks to each of the functions
######by referencing their names
##
##callbacks = [ function_1 , function_2 , function_3 ]
##
######display a heading and the result of passing a value to each
of the
######named functions:
##
##print( '\nNamed Functions:' )
##for function in callbacks : print( 'Result:' , function( 3 )
)
##
####Task 3. Run the code above. Understand it. Display callback
for
####the situation when you need to run 2*function_1,
2*function_2,2*function_3,
####for x = 10, show that your code works.
In: Computer Science
In: Computer Science
1. Write a program in C++ to find the factorial of a number.
Prompt the user for a number and compute the factorial by using the
following expression. Use for loops to write your solution
code.
Factorial of n = n! = 1×2×3×...×n; where n is the user input.
Sample Output:
Find the factorial of a number:
------------------------------------
Input a number to find the factorial: 5
The factorial of the given number is: 120
2. Code problem 1 using While loop.
3. Write the code for a C++ program testMath.cpp that reads in two
integer numbers from user input. Write the following functions in
addition to the main() function for computing and returning the
following to the main( ) function. 1. Function sum( ) computes and
returns the sum of the two numbers, 2. Function diff( ) computes
and returns the difference of the two numbers (always positive), 3.
Function avg( ) computes and returns the average, 4. Function max(
) computes and returns the maximum of the two numbers 5. Function
min( ) computes and returns the minimum of the two numbers
The main( ) function performs the unit testing and tests all the
functions.
Sample Output
This program reads in two integer numbers from user input
and returns their sum, difference, average, maximum and
minimum.
Please enter the two numbers: 17 5
The numbers entered are 17 and 5.
The sum of 17 and 5 is: 22
The difference of 17 and 5 is: 12
The average of 17 and 5 is: 11
Fall 2019
The maximum of 17 and 5 is: 17
The minimum of 17 and 5 is: 5
In: Computer Science
Read in the names of several grocery items from the keyboard and create a shopping list using the Java ArrayList abstract data type.
Flow of Program:
1) Create a new empty ArrayList
2) Ask the user for 5 items to add to a shopping list and add them to the ArrayList (get from user via the keyboard).
3) Prompt the user for an item to search for in the list. Output a message to the user letting them know whether the item exists in the shopping list. Use a method that is part of the ArrayList class to do the search.
4) Prompt the user for an item to delete from the shopping list and remove it. (be sure to handle the case where they don’t want to delete anything). Use a method that is part of the ArrayList class to do the delete.
5) Prompt the user for an item to insert into the list. Ask them what they want to insert and where they want to insert it (after which item). Use a method that is part of the ArrayList class to do the insertion.
6) Output the final list to the user.
In: Computer Science
Task #1 – Software Sales
A software company sells a package that retails for $99. Quantity
discounts are given according to the following:
Quantity Discount
1 - 9 NO DISCOUNT
10 – 19 20%
20 – 49 30%
50 – 99 40%
100 or more 50%
Your program calculates the final purchase price of the software
packages based on the quantity purchased. If a value of 0 or less
(a negative number) is entered, display the message “Invalid
Quantity” and end the program.
Input:
Ask the user to enter the quantity of packages purchased.
Process:
Calculate the subtotal (quantity * $99)
Apply the discount based on the discount schedule shown
above.
Output:
Display the number of products purchased, the amount of the
discount (if any) and the total amount of the purchase after the
discount. Correctly format your output as currency ($xx.xx).
Sample User Input:
Enter the number of products purchased > 15
Sample User Output:
Your purchase of 15 products provides a quantity discount is
20%
Your total purchase price is $1198.00
Task #2 – The Bookseller
As a bookseller, you have a book club that awards points to its
customers based on the number of books published each month.
The points awarded are as follows:
If the customer purchases 0 books, he/she earns 0 points
If the customer purchases 1 book, he/she earns 5 points
If the customer purchases 2 books, he/she earns 15 points
If the customer purchases 3 books, he/she earns 30 points
If the customer purchases 4 or more books, he/she earns 60
points
Write a program that asks the user to enter the number of books
that he or she has purchased and then displays the number of points
awarded. Use the SWITCH statement for this problem.
Input:
Prompt the user for the number of books purchased
Process:
Determine the number of points awarded based on the point schedule
shown above
Output:
Display the number of points earned
Sample User Input:
Enter the number of books purchased > 1
Sample User Output:
You have earned 5 points
Task #3 – How much would you weigh on Mars
This task allows the user to determine how much they would weigh on
any one of the planets in our Solar System.
How much you weigh depends on your mass, the mass of the planet,
and the distance you are from the center of the planet. Since the
various planets in our Solar System are different sizes, you will
weigh less or more depending on the planet you are on. I will spare
you some of the calculations and simplify it to: Weight = Mass x
Surface Gravity
So, if you know your weight on Earth and the surface gravity on
Earth, you can calculate your mass. You can then calculate your
weight on any other planet by using the surface gravity of that
planet in the same equation.
Process:
Read the Planet Name
Read your body mass
Using the Table of Mass shown below, calculate and display your
weight using the equation:
Weight = Mass x Surface Gravity
Table of Surface Gravity for various planets
Mercury: 0.055
Venus: 0.82
Earth: 1.0
Mars: 0.11
Jupiter: 318
Saturn: 95.2
To simplify even further, I’m not giving you all of the planets in
our Solar System.
In order to perform this task, you need some form of selection
flow. The choice is up to you!
You will need to validate that a correct planet name was entered.
Consider a mixed case entry of the planet – this is acceptable.
However, misspellings are NOT acceptable.
If not, display a message indicating that the name entered was
invalid and then exit the program!
Case 1:
Sample User Input for valid user input:
Enter the planet name> EArth
Enter your body mass (in pounds) > 100
Sample User Output:
Based on your body mass of 100, on the planet Earth, you would
weigh 100 pounds
Case 2:
Sample User Input for invalid user input:
Enter the planet name> Earttttth
Enter your body mass (in pounds) > 100
Sample User Output:
You have entered an invalid planet name
Need this code in Java!
In: Computer Science
Provide an example for each of the following types of data model:
-Conceptual data models
-Physical data models
-Representational data models
In: Computer Science
Create a class named Employee and its child class named Salesperson. Save each class in its
own file. Name your class and source code file containing the main method
homework.java.
Make sure each class follows these specifications:
1. An employee has a name (String), employee id number (integer), hourly pay rate
(double), a timesheet which holds the hours worked for the current week (double array)
and email address (String). A salesperson also has a commission rate, which is a
percentage stored as decimal value (double).
2. Override the toString method in each class to display all data (except the timesheet array)
available about each object.
3. Each class should have an appropriate constructor to set the values of all private data
members belonging to that class and its parent classes at the time of instantiation.
4. Each class should have get and set methods for their unique private data members.
5. For the timesheet array, it is an array which stores 1 week of hours worked since
employees are paid every week on Monday. Weeks start on Monday and run through
Sunday so Monday hours are stored in the first position of the array and Sunday hours are
stored in the last position of the array.
6. Design a calculatePay method for each type of employee as follows:
A regular employee gets paid their hourly rate for their first 40 hours of work in a
week and then gets 1.5 times their hourly rate for any hours worked over 40 in a
week.
A salesperson gets their pay calculated the same as the regular employee (aka regular
pay) with an addition of their sales commission earned. Their sales commission is
earned by multiplying the salesperson's commission rate by the weekly sales total,
which is supplied as an argument when the method is called. The sales commission
earned for the week is then added to the regular pay to calculate the salesperson's total
pay for the week.
This method uses hours worked in the timesheet array and the hourly rate to make its
calculations of the regular pay for all types of employees, even salespeople.
Salespeople just have the additional sales commission added to their pay.
All employees have 35% of their total pay withheld from their checks for taxes.
Page 2 of 2
This method should return a double representing the employee's total pay for the
week accounting for sales commission (if any) and taxes withheld.
After creating the two classes, write a program with a main method that uses the Employee and
Salesperson classes to create objects for an employee and a salesperson being sure to assign data
to all data members including those inherited from the parent class. You can use any data you
wish for the objects, but you must use the constructors you defined to set the data values at the
time of object instantiation.
After creating the two objects, your program should then do the following things in order:
Invoke the toString method for each object.
Print the timesheet for the current pay period for each object.
Change the email address of the salesperson.
Print the saleperson's name and changed email address
Change the commission rate for the salesperson increasing it by 5%.
Invoke the toString method for the salesperson to show the change in commission rate.
Print the paycheck amounts for the current pay period for both objects.
For this assignment, you should end up with different source code files for each of the 2 classes
(Employee and Salesperson). The main method should also be in a different source code file
named homework.java
In: Computer Science
PYTHON CODE:
def square_matrix_multiplication(matrix1,matrix2):
C=[[0 for i in range(len(matrix1))] for i in
range(len(matrix2))]
for i in range(len(matrix1)):
for j in range(len(matrix2[0])):
C[i][j]=0
for k in range(len(matrix2)):
C[i][j] += matrix1[i][k]*matrix2[k][j]
return C
I use that function in my code. When I type like "return C", It does not work. If I type print(C), then my code works. Why is it happening?
I created two user-entered matrices above the function, then I called the function.
In: Computer Science
Note: If the switch did not prompt you for a password, then you did not configure the login parameter in Step 2.
Step 4: Secure privileged mode access.
Set the enable password to c1$c0. This password protects access to privileged mode.
Note: The 0 in c1$c0 is a zero, not a capital O. This password will not grade as correct until after you encrypt it in Step 8.
S1> enable
S1# configure terminal
S1(config)# enable password c1$c0
S1(config)# exit
%SYS-5-CONFIG_I: Configured from console by console
S1#
Step 5: Verify that privileged mode access is secure.
a. Enter the exit command again to log out of the switch.
b. Press <Enter> and you will now be asked for a password:
User Access Verification
Password:
c. The first password is the console password you configured for line con 0. Enter this password to return to user EXEC mode.
d. Enter the command to access privileged mode.
e. Enter the second password you configured to protect privileged EXEC mode.
f. Verify your configurations by examining the contents of the running-configuration file:
S1# show running-config
Notice how the console and enable passwords are both in plain text. This could pose a security risk if someone is looking over your shoulder.
Step 6: Configure an encrypted password to secure access to privileged mode.
The enable password should be replaced with the newer encrypted secret password using the enable secret command. Set the enable secret password to itsasecret.
S1# config t
S1(config)# enable secret itsasecret
S1(config)# exit
S1#
Note: The enable secret password overrides the enable password. If both are configured on the switch, you must enter the enable secret password to enter privileged EXEC mode.
Step 7: Verify that the enable secret password is added to the configuration file.
a. Enter the show running-config command again to verify the new enable secret password is configured.
Note: You can abbreviate show running-config as
S1# show run
b. What is displayed for the enable secret password?
c. Why is the enable secret password displayed differently from what we configured?
Step 8: Encrypt the enable and console passwords.
As you noticed in Step 7, the enable secret password was encrypted, but theenable and console passwords were still in plain text. We will now encrypt these plain text passwords using the service password-encryptioncommand.
S1# config t
S1(config)# service password-encryption
S1(config)# exit
If you configure any more passwords on the switch, will they be displayed in the configuration file as plain text or in encrypted form? Explain.
Part 3: Configure a MOTD Banner
Step 1: Configure a message of the day (MOTD) banner.
The Cisco IOS command set includes a feature that allows you to configure messages that anyone logging onto the switch sees. These messages are called message of the day, or MOTD banners. Enclose the banner text in quotations or use a delimiter different from any character appearing in the MOTD string.
S1# config t
S1(config)# banner motd "This is a secure system.Authorized Access Only!"
S1(config)# exit
%SYS-5-CONFIG_I: Configured from console by console
S1#
1) When will this banner be displayed?
2) Why should every switch have a MOTD banner?
Part 4: Save Configuration Files to NVRAM
Step 1: Verify that the configuration is accurate using the show run command.
Step 2: Save the configuration file.
You have completed the basic configuration of the switch. Now back up the running configuration file to NVRAM to ensure that the changes made are not lost if the system is rebooted or loses power.
S1# copy running-config startup-config
Destination filename [startup-config]?[Enter]
Building configuration...
[OK]
What is the shortest, abbreviated version of the copy running-config startup-config command?
Step 3: Examine the startup configuration file.
Which command will display the contents of NVRAM?
Are all the changes that were entered recorded in the file?
Part 5: Configure S2
You have completed the configuration on S1. You will now configure S2. If you cannot remember the commands, refer to Parts 1 to 4 for assistance.
Configure S2 with the following parameters:
a. Name device: S2
b. Protect access to the console using the letmein password.
c. Configure an enable password of c1$c0 and an enable secret password of itsasecret.
d. Configure a message to those logging into the switch with the following message:
Authorized access only. Unauthorized access is prohibited and violators will be prosecuted to the full extent of the law.
e. Encrypt all plain text passwords.
f. Ensure that the configuration is correct.
g. Save the configuration file to avoid loss if the switch is powered down.
Suggested Scoring Rubric
|
Activity Section |
Question Location |
Possible Points |
Earned Points |
|
Part 1: Verify the Default Switch Configuration |
Step 2b, q1 |
2 |
|
|
Step 2b, q2 |
2 |
||
|
Step 2b, q3 |
2 |
||
|
Step 2b, q4 |
2 |
||
|
Step 2b, q5 |
2 |
||
|
Part 1 Total |
10 |
||
|
Part 2: Create a Basic Switch Configuration |
Step 2 |
2 |
|
|
Step 7b |
2 |
||
|
Step 7c |
2 |
||
|
Step 8 |
2 |
||
|
Part 2 Total |
8 |
||
|
Part 3: Configure a MOTD Banner |
Step 1, q1 |
2 |
|
|
Step 1, q2 |
2 |
||
|
Part 3 Total |
4 |
||
|
Part 4: Save Configuration Files to NVRAM |
Step 2 |
2 |
|
|
Step 3, q1 |
2 |
||
|
Step 3, q2 |
2 |
||
|
Part 4 Total |
6 |
||
|
Packet Tracer Score |
72 |
||
|
Total Score |
100 |
||
In: Computer Science