Questions
In C++ Prompt user to enter two integers •Determine whether the first number is divisible by...

In C++

Prompt user to enter two integers

•Determine whether the first number is divisible by the second. If the second number is zero, the program should not do division

•Output the remainder of the two numbers

•Compare the two integers, display the integers in non-decreasing order.

In: Computer Science

public class IntNode               {            private int data;            pri

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...


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...

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...

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...

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.

  • Create interfaces named Depositable, Withdrawable, and Balanceable that specify the methods that can be used to work with accounts. The Depositable interface should include this method:

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)

  • Create a class named Account that implements all three of these interfaces. This class should include an instance variable for the balance.
  • Create a class named CheckingAccount that inherits the Account class. This class should include an instance variable for the monthly fee that’s initialized to the value that’s passed to the constructor. This class should also include methods that subtract the monthly fee from the account balance and return the monthly fee.
  • Create a class named SavingsAccount that inherits the Account class. This class should include instance variables for the monthly interest rate and the monthly interest payment. The monthly interest rate should be initialized to the value that’s passed to the constructor. The monthly interest payment should be calculated by a method that applies the payment to the account balance. This class should also include a method that returns the monthly interest payment.
  • Create a class named AccountBalanceApp that uses these objects to process and display deposits and withdrawals.
  • Use the Console class presented in chapter 7 or an enhanced version of it to get and validate the user’s entries. Don’t allow the user to withdraw more than the current balance of an account.

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...

############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

Research Operating systems, and report on what resources you could use to get authoritative information about...

  • Research Operating systems, and report on what resources you could use to get authoritative information about mainstream modern Operating Systems.
  • Write a 1-2 page paper explaining your experience and reasons why OS analysis could benefit or has benefitted your forensic experience.

In: Computer Science

1. Write a program in C++ to find the factorial of a number. Prompt the user...

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

Explain Ethics in research.

Explain Ethics in research.

In: Computer Science

Read in the names of several grocery items from the keyboard and create a shopping list...

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...

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...

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...

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...

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