Questions
. A simple way to encrypt a number is to replace each digit of the number...

. A simple way to encrypt a number is to replace each digit of the number with another digit. Write a C program that asks the user to enter a positive integer and replace each digit by adding 6 to the digit and calculate the remainder by 10. For example, if a digit is 6, then the digit is replaced by (6+6)%10, which is 2. After all the digits are replaced, the program then swap the first digit with the last digit. The main function reads in input and displays output.

A sample input/output:

Enter the number of digits of the input number: 3

Enter the number: 728

Output: 483

2) The user will enter the total number of digits before entering the number.

3) You can use format specifier "%1d" in scanf to read in a single digit into a variable (or an array element). For example, for input 101011, scanf("%1d", &num) will read in 1 to num.

4) As part of the solution, write and call the function encrypt() with the following prototype.

The function assumes that the digits are stored in the array a and computes the encrypted digits and store them in the array b. c represents the size of the arrays. void encrypt(int *a, int *b, int n); The function should use pointer arithmetic – not subscripting – to visit array elements. In other words, eliminate the loop index variables and all use of the [] operator in the function.

5) As part of the solution, write and call the function swap() with the following prototype. void swap(int *p, int *q);

When passed the addresses of two variables, the swap() function should exchange the values of the variables: swap(&i, &j); /* exchange values of i and j */

In: Computer Science

Design a Python program with a While loop that lets the user enter a number. The...

Design a Python program with a While loop that lets the user enter a number. The number should be multiplied by 10 and the result

stored in a variable named "product". The loop should repeat as long as the product variable < 10. Anything not completely obvious to a newbie should be commented on as in line comments. Should be modulated and repeatable as well as there should be an invocation of the main routine at the end of the program.

Grading Rubrick

Program Compiles Cleanly syntax errors
25 pts -5 per error
Program runs without runtime errors ( validation) run-time errors
25 pts -5 per error
Program give correct answers Logic errors
30 pts -5 per error
Program is repeatable Not repeatable
5 pts -5 pts
Program is well modularized Barely Modularized
10 pts - 5 pts
Documented Well Documented Some
5 pts - 3 pts
Something Cool (but relevant) beyond strict requirements Something extra
5 pts + 3 pts
Best possible grade : 105

In: Computer Science

What is the legal basis of the argument that privacy is a right?

What is the legal basis of the argument that privacy is a right?

In: Computer Science

hello! So I have this CIS assignment lab but when I try to make the code...

hello! So I have this CIS assignment lab but when I try to make the code I don't really know where to start from. My professor is very hard and he likes to see the outcomes as they are shown in the problem. Please help me! the program should be a C++ PLS

Write a program that can be used as a math helper for an elementary student. The program should display two random integer numbers that are to be added, such as:
    247
+ 129
-------

The program should wait for the students to enter the answer. If the answer is correct, a message of congratulations should be printed. If the answer is incorrect, a message should be printed showing the correct answer.

The program displays a menu allowing the user to select an addition, subtraction, multiplication, or division problem. The final selection on the menu should let the user quit the program. After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program.
Input Validation: If the user select an item not on the menu, display an error message and display the menu again.

Requirements:

Addition
Generate two random numbers in the range 0 - 9.

Subtraction

Generate two random numbers in the range 0 - 9.
num1 = rand() % 10;
num2 = rand() % 10;
Make sure num2 <= num1...
while (num2 > num1)
num2 = rand() % 10;

Multiplication

Generate two random numbers. The first in the range 0 - 10, the second in the range 0 - 9.

Division

Generate a single digit divisor
num2 = rand() % 9;
Generate a num1 that is a multiple of num2 so the division has no remainder. The num1 is never zero.
num1 = num2 * (rand() % 10 + 1);

All constant values must be declare as a constant variable. Use the constant variable in the calculation.
Validating the selection (1 to 5). If the selection is not in the range between 1 and 5, the program keeps asking the input until the correct selection is entered.
Comments in your program to explain the code logic and calculation.


Output sample:

Menu
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program

Enter your choice (1-5): 1
   1
+ 2
   ---
   4

Sorry, the correct answer is 3.
Menu
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
Enter your choice (1-5): 7
The valid choices are 1, 2, 3, 4, and 5. Please choose: 2
    8
+ 6
    ---
    2
Congratulations! That's right.
Menu
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
Enter your choice (1-5): 3
     9
*   4
    ---
   36

Congratulations! That's right.
Menu
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
Enter your choice (1-5): 4
8 / 2 = 4
Congratulations! That's right.
Menu
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
Enter your choice (1-5): 4
6 / 2 = 3
Congratulations! That's right.
Menu
1. Addition problem
2. Subtraction problem
3. Multiplication problem
4. Division problem
5. Quit this program
Enter your choice (1-5): 5

"Thank you for using math helper!"

In: Computer Science

Consider a set of n boxes with their positions numbered from 1 to n. Initially all...

Consider a set of n boxes with their positions numbered from 1 to n. Initially all the boxes
are CLOSED. These n boxes are subject to modifications over n iterations as follows. At the ith
iterations the boxes at the positions whose ids are multiples of i are flipped, i.e. changed from
CLOSED to OPEN or vice-versa. For example, at iteration 1, boxes at all positions are
flipped, at iteration 2, boxes at positions 2,4,6,etc. are flipped, at iteration 3, boxes at positions 3,6,9, etc.
are flipped.
Propose an algorithm for find out, that after n such iterations how many boxes will be OPEN.
Note that the answer requires only how many boxes, not their positions. Describe the rationale
for the algorithm, give the pseudocode, and its complexity. Grading scheme: (your grade will be
based on whichever class your algorithm falls in)
- For algorithms with complexity O(kn), where k is the number of digits of n.

In: Computer Science

Grocery Store using Java Arraylist Requirements: 1. Need Product Class and Stock Class 2. Use arraylist...

Grocery Store using Java Arraylist

Requirements:

1. Need Product Class and Stock Class

2. Use arraylist to store/ add product in stock

3. Product must have name, code number and quantity in stock

4. Print list of the products and their stock quantity

5. Search products based on their name 6. Remove product based on their code number

7. Sell product and deduct quantity from stock

8. Stock Class contains methods of search product, add product and check quantity of the product

9. Product Class contains method of get product details

In: Computer Science

Please write this program in C++ Write a program that           - a user-defined class Cuboid...

Please write this program in C++

Write a program that

          - a user-defined class Cuboid which has the following elements:

                   - default constructor (has no parameters)

                   - constructor that has 3 parameters (height, length, width)

                   - data members

                             - height, length, width

                   - member functions

                             - to set the value of each of the data members - 3 functions

                             - to get the value of each of the data members - 3 functions

                             - one that returns the volume

                             - one that returns the surface area

                             - one that increases each dimension by a specified factor

                   (Function definitions outside of the class!!!)

          - in main()

                   - instantiate a Cuboid object and initialize at the time of definition

                             - make sure the constructor with parameters is called

                      - define an array of 2 Cuboid objects

                      - using a loop get information to populate the 2 objects in the array

                               -prompt for the height, length, and width

                                -prompt for a size by which to increase each dimension(one input)

      -call a global function passing a Cuboid object and the increase factor as separate arguments; function will call the class member function to increase the dimensions; parameters of the function should be references

                  -display the dimensions, the volume, and the surface area for each of the three objects.

                         

                       

In: Computer Science

In python import numpy as np Given the array b = np.arange(-6, 4) compute and print...

In python

import numpy as np

Given the array b = np.arange(-6, 4) compute and print

1.) The array formed by \(bi^2 - 1\), where the \(bi\) are the elements of the array b.

2.) The array formed by multiplying b with the scalar 100.

3.)The array formed by 2.0 b i in reverse order. (Note: the base 2.0 must be a floating point number; for integer values a ValueError: Integers to negative integer powers are not allowed. is raised.)

4.) The array delta of length len(b)-1 that contains the differences between subsequence entries of \(bi^3\), namely \(\deltai = b{i+1}^3 - bi^3 \) with 0 ≤ i < N − 1 where N is the length of b. Print both delta.shape and delta.

In: Computer Science

Modeling multiprogramming: (a) Assume the I/O fraction time of all processes is 20%, and assume processes...

Modeling multiprogramming: (a) Assume the I/O fraction time of all processes is 20%, and assume processes are independent from each other, what’s the CPU utilization, if the number of processes, n = 1, 2, 4, and 8, respectively? (b) If the I/O fraction time is 50% for all processes, what’s the CPU utilization again, if the number of processes, n = 1, 2, 4, and 8, respectively?

In: Computer Science

1, Bitcoin and blockchain are the same thing. true false 2, Operational efficiency and operational effectiveness...

1, Bitcoin and blockchain are the same thing.

true

false

2, Operational efficiency and operational effectiveness are the same thing.

true

false

3, Bill Gates was the sole founder of Microsoft.

true

false

In: Computer Science

Project on a double pendulum using MATLAB. I have simulated double pendulum chaos using the code...

Project on a double pendulum using MATLAB. I have simulated double pendulum chaos using the code I found in Chegg. Could you please guide in adding a code to determine the time it takes for the second arm of the pendulum to "flip" based on initial starting conditions?

In: Computer Science

List at least six reasons of why mobile apps are essential and preferable than traditional websites...

List at least six reasons of why mobile apps are essential and preferable than traditional websites for everyday business

In: Computer Science

Do the following: • Download Wireshark. • Start Wireshark. • Turn on Wireshark capture. • Type...

Do the following: • Download Wireshark. • Start Wireshark. • Turn on Wireshark capture. • Type a URL in your browser window (not Wikipedia.org). • After a few seconds, stop the capture. • Answer the following questions: 1a. What URL did you use? What was the IP address of the webserver?

1b. Find the frame in which your PC sent the SYN packet. List the source and destination IP address, the source and destination port numbers, and the header checksum.

1c. Select the SYN/ACK packet. List the source and destination IP address, the source and destination port numbers, and the header checksum.

1d. Select the packet that acknowledges the SYN/ACK segment. List the source and destination IP address, the source and destination port numbers, and the header checksum. 2. Change the options so that only packets you send are recorded. Do a capture. Click on the window containing Wireshark and hit Alt-Enter. This captures the window to your clipboard. Paste it into your homework.

In: Computer Science

In Unity with C#, I need to implement a dice simulator in my character generator(D&D). I...

In Unity with C#, I need to implement a dice simulator in my character generator(D&D). I have 6 sides of UI images(2D). With my code, I am able to roll and get the number in my console text(randomly).

But, I need help for rolling 5 dices, not the 1 dice. Also, I need to add all the three highest rolls with 5 dices and get a result in my display.

Ex) 1. Players must roll 5d6 and add the three highest rolls to compute each of the six Abilities. Note make all modifiers default to +2.

In: Computer Science

Must be in C++ and we can not use STR[] we must use STR.at() Write a...

Must be in C++ and we can not use STR[] we must use STR.at()

Write a program that:

  1. Declares a variable suitable for holding a person’s name
  2. Prompts the user to enter a person’s name with the text Enter name:
  3. Reads the user's input and stores it in the variable created in step 1
  4. Outputs the following information about the name they entered
    a. The index of the last character in the name
    b. The last 3 characters of the first name
    c. The first 3 characters of the last name
    Your output should look like the examples below. **Note: Your code should account for the fact that the user might enter a middle name or initial.

Example 1:

Enter name: Grace Hopper
Index of last character: 11
Last 3 characters of first name: ace
First 3 characters of last name: Hop

Example 2:

Enter name: Dorothy J. Vaughan
Index of last character: 17
Last 3 characters of first name: thy
First 3 characters of last name: Vau

This is my code:

#include <iostream>
#include <string>
using namespace std;

int main()
{
   string userFirstname;
   string userLastname;
   string userMiddlename;

   cout << "Enter Name: ";
   cin >> userFirstname;
   cin >> userMiddlename;
   cin >> userLastname;
   cout << userFirstname << userMiddlename << userLastname << endl;

   cout << "Index of last character: ";
   cout << ((userFirstname.size() + userLastname.size()) - 1);
   cout << endl;

   cout << "Last 3 characters of first name: ";
   cout << (userFirstname.at(userFirstname.size() - 3)) << (userFirstname.at(userFirstname.size() - 2)) << (userFirstname.at(userFirstname.size() - 1)) << endl;

   cout << "First 3 characters of last name: ";
   cout << userLastname.at(1) << userLastname.at(2) << userLastname.at(3) << endl;

   return 0;
}

In: Computer Science