Write an algorithm that doubles ALL the prime values of a linked lists, and then output the whole new list.
In: Computer Science
Code in c++, do not use loops, make it as simple as it can be. Thanks!
Background Well it has finally happened; AMC’s “The Walking Dead” has become a reality. The zombie apocalypse took place. It has been a couple of years since we have started to “rebuild” our society, and now is the time for you to be able to shine. We have come across technology that will allow for us to get back to life as it once was in the early 2000’s. Yes, we are still going to be 17 years back but it’s better than nothing. With all the Computer Scientists and Engineers that survived in the area, everything is almost back to normal except for the use of cell phones. People have been able to start-up businesses again, and we are trying to become as we once were. People work and get paid and of course we want the commodities that we once had. In a venture of remembering how people were glued to their cell phones you have decided to start a service. Why not!? You found a warehouse that had all the cell phones that you can distribute to those around in the area, and you have been working with others to get an infrastructure back. You now just have to come up with a quick system to be able to get people hooked before they get used to not having their phones anymore. With the fact that you must have a quick turn-around, you are putting together a simple plan and will later expand on the idea. You have everything ready to go and to sign people up, but you still need the billing to be generated. This is what you must work on now. You are only going to give users the options of two types of service, regular and premium.
To compute the rates you have the following established: 1. Regular service - $6.00 plus first 50 minutes free. Charges for over 50 minutes are $0.20 per minute. 2. Premium service - $15.00 plus: a. For calls made from 6:00am to 6:00pm, the first 75 minutes are free; charges for over 75 minutes are $0.10 per minute. b. For calls made from 6:00pm to 6:00am, the first 100 minutes are free; charges for over 100 minutes are $0.05 per minutes. Task Your task at the moment is to calculate and print out the bill for your customers. Your program should: 1. prompt the user to enter an account number, 2. a service code (type char), a. A service code of r or R means regular service b. A service code of p or P means premium service c. Treat any other character as an error 3. the number of minutes the service was used. Your program should output the account number, type of service, number of minutes the telephone service was used, and the amount due from the user. For the premium service, the customer may be using the service during the day and the night. Therefore, to calculate the bill, you must ask the user to input the number of minutes the service was used during the day and the number of minutes the service was used during the night. Concepts to follow: 1. Assign values to all constant variables that are associated with charges and number of minutes provided in the problem description. 2. The only information the user enters are: account number, type of service, minutes used, and day/night time minutes used based on the plan they have. 3. Remember you are dealing with money therefore should only have 2 decimal places. 4. You must use both a switch statement AND if/else, if/else if’s, or if’s as you see fit. 5. Keep in mind to check for input validation. If validation is incorrect you should have an error message and “kill” your program. 6. Do not use loops
In: Computer Science
Ch 4 Program 4A: Factorial.java
Please adhere to the Standards for Programming Assignments and the Java Coding Guidelines.
Write a program that computes the factorial of a number that is
input from the user.
A factorial is the product of all the numbers up to the number entered.
For example, 6-factorial is 720 because 6*5*4*3*2*1 is 720.
Six-factorial is written as 6!
Prompt the user for the numeric input between 1 and 10.
Do not accept numbers greater than 10 or less than 1.( Check out the input/data Validation page on Canvas in module 4B)
Calculate and display the factorial. All code must reside in the main() method
Do not use any concept that is not covered in class.
Include output from this Test Data: 22
7
1
|
Example Output with Valid inputs: *******Factorial********* Please enter a value between 1-10: 5 5! = 120 Goodbye!! Example Output with an Invalid input: *******Factorial********* Please enter a value between 1-10: 12 Value is out of range. Please Re-enter a value between 1-10 : 17 Value is out of range. Please Re-enter a value between 1-10 : 8 8! = 40320 Goodbye!! |
In: Computer Science
Discuss the type of noise that is the most difficult to remove from an analog and a digital signal? Give reasons for your answer. How does error detection and correction work with wireless signals? Is data compressed when being transmitted? Describe the process.
In: Computer Science
Describe how component-based development is used during the requirements gathering and definition within the Agile process (software engineering).
In: Computer Science
in java
Write a program that convert a Fahrenheit to Celsius. For conversion, use as many as methods you want
In: Computer Science
Later you will be making a logo for your project website. For now, you are going to style a photograph for your project.
Choose at an appropriate picture from one of these sources:
Save your original photograph with the names of original.psd and original. jpg before you modify it.
Then use "save as" to create another copy of your photograph and modify it using at least TWO techniques covered so far. You may do more if you wish.
Integrate your final photograph into your Dreamweaver website.
Turn in the following:
1. Both the original and modified photographs in a zipped file that you upload here, four files total. (60 points)
2. In your submission comments, provide the URL of your webpage where you have put the file on MyDrive. Your graphic should be in a separate folder for graphics, and your image and web page should render properly. If your graphic doesn't appear, check the reference. (30 points)
3. AND, also in the submission comments, describe the modifications you made to your photograph. (10 points)
In: Computer Science
Andrea Stevens Cosmetics is a small cosmetics company that has a network of 30 computers. They are currently using a 100BaseT network that is wired with Category 6 Plenum cable. Their computers were purchased six years ago as a single buy from Dell. The computers have single Intel i3 processors, 2 GB RAM, and 500 GB hard drives. Their network has two 24 port hubs and a gateway router that connects them to a Cox cable modem. Most of their computers are used for order processing and inventory control. The computers are arranged in a workgroup called ASC, with all hard drives and printers shared. The manufacturing plant has computerized equipment that is on a separate network that is self-contained and isolated. You are hired as a consultant to bring their network into the 21st century. Based on your knowledge, experience, and what you have read in this week's assignment, propose an upgrade to this architecture. Describe the components you would recommend and how the network would be configured. Your goal should be a network that will support them for the next five years. Because the information in this mini-case is limited, you will have to make some assumptions. Be sure to document any assumptions that you make.
In: Computer Science
Write a C program that reads three integers and then prints them in the order read and reversed. Use four functions: main, one to read the data, one to print them in the order read, and one to print them reversed.
In: Computer Science
Someone once said, "if you gave everyone in the world a million dollars and if you waited long enough then 1 person would have all the money and everyone else would have nothing". You are going to write a program to test truthfullness of that statement.
Repeat the following actions until nActive equals 1:
using this code
#include "fixed1dintarray.h"
fixed1dintarray::fixed1dintarray(int newnelts)
{
if (newnelts < 2)
newnelts = 16;
size = newnelts;
nelts = 0;
elts = new int[size];
}
bool fixed1dintarray::isEmpty()
{
return nelts == 0;
}
bool fixed1dintarray::isFull()
{
return nelts == size;
}
int fixed1dintarray::getsize()
{
return size;
}
int fixed1dintarray::getnelts()
{
return nelts;
}
bool fixed1dintarray::getelt(int where, int& elt)
{
bool isgood = 0 <= where && where < nelts;
if (isgood)
elt = elts[where];
return isgood;
}
bool fixed1dintarray::member(int value)
{
return find(value) >= 0;
}
int fixed1dintarray::find(int value)
{
int pos = 0;
//while(!(pos < nelts || elts[pos] == value))
//until(pos == nelts || elts[pos] == value)
while (pos < nelts && elts[pos] != value)
pos++;
if (pos < nelts)
return pos;
else
return -1;
}
bool fixed1dintarray::insat(int where, int elt)
{
if (isFull())
return false;
if (where < 0 || nelts < where)
return false;
for (int pos = nelts - 1; pos >= where; pos--)
elts[pos + 1] = elts[pos];
elts[where] = elt;
nelts++;
return true;
}
bool fixed1dintarray::append(int elt)
{
return insat(nelts, elt);
}
bool fixed1dintarray::delat(int where)
{
if (where < 0 || nelts <= where)
return false;
for (int pos = where + 1; pos < nelts; pos++)
elts[pos - 1] = elts[pos];
return false;
}
bool fixed1dintarray::delelt(int elt)
{
int where = find(elt);
return delat(where);
}
void fixed1dintarray::show()
{
for (int i = 0; i < nelts; i++)
cout << elts[i] << ' ';
}
In: Computer Science
Write a program that asks a user how many classes they are taking this term, the name of each class, the credit hours for each class, and their final letter grade for each class, and then calculates their term GPA. Use either a list for each course or a single list-of-lists. The grading system and examples can be found on the TAMU website: http://registrar.tamu.edu/Transcripts-Grades/How-to-Calculate-GPA
In: Computer Science
Writing a caesar cipher in ARM assembly.
INSTRUCTIONS:
Step 1:
The first thing you should do is modify the case conversion program String.s (provided)
Instead of subtracting 32 from all numbers you want to add a constant number which we will call the key.
Assume that all input will be lowercase.
So it'll look like this,
k = 2;
letter = 'a';
newletter = k+letter;
Above is pseudocode and ABOVE NOT ASSEMBLY CODE DO NOT COPY.
Use bl puts to show that everything is working correctly.
You should hard code the plaintext in the assembly file.
Step 2:
If the key + letter is bigger is 'z' then you have to subtract 26.
If the key + letter is less than 'a' then you have to add 26.
STRING.S
.text
.global main
main:
ldr r4,=string
get_another_byte:
ldrb r5,[r4]
cmp r5,#'a'
# blt keep_going
# cmp r5,#'z'
# bgt keep_going
subeq r5,#32
strbge r5,[r4]
keep_going:
add r4,#1
cmp r5,#0
bne get_another_byte
ldr r0,=temp
str lr,[r0]
ldr r0,=string
bl puts
ldr r0,=temp
ldr lr,[r0]
bx lr
.data
string:
.asciz "This is a string"
temp:
.word 0In: Computer Science
import java.util.*;
import java.security.*;
import javax.crypto.*;
import java.nio.file.*;
public class CryptoApp {
public static void main(String[] args) throws Exception {
Crypto crypto = new BasicCrypto();
String welcome = "Hello
2043-er's! Let's try this again :-)";
System.out.println(welcome);
// First, where are we?
//Let's print out our current working directory
Path cwd =
FileSystems.getDefault().getPath("").toAbsolutePath();
System.out.println("Current Working Directory: " + cwd);
// Read in our file to encrypt
byte[] originalData =
Files.readAllBytes(Paths.get(System.getProperty("user.home"),
"C-2044-Sample/Crypto/src/encrypt.txt"));
// Encrypt it and save into a byte array
byte[] encryptedData = crypto.encrypt(originalData);
// Decrypt it and save it into
another byte array
byte[] decryptedData = crypto.decrypt(encryptedData);
// Write the encrypted text into the original file
Files.write(Paths.get(System.getProperty("user.home"), "test"),
encryptedData);
// Write the decrypted text into the decrypted text file
Files.write(Paths.get(System.getProperty("user.home"),
"C-2044-Sample/Crypto/src/decrypt.txt"), decryptedData);
String sendoff = "It's a wrap!";
System.out.println(sendoff);
}
}
Ok so for this code I changed the name of the file from java-2022 to C-2044 to intentionally create an exception.
Exception in thread "main" java.nio.file.NoSuchFileException: /home/runner/C-2044-Sample/Crypto/src/encrypt.txt
so how would I write a try/catch/finally cause to catch one or more specific exception objects.
In: Computer Science
In C programming. If a grammatically correct input is entered,
the program should convert the two
strings to two integer arrays and perform the given operation on
each array location.
For all operations, consider each corresponding array position
independently (e.g.,
there are no carries). The resulting array should then be converted
back to a string,
and finally printed. If the two input strings are not the same
length, then each output
character beyond the length of the shorter string should be a copy
of the character
from the longer string with the opposite case.
The mathematical operations work as follows. Each symbol should be
converted to
an integer as shown in the table to the right (i.e., a is 0, b is
1, c is 2, …, U is 46).
This mapping forms a finite field, and we can define addition and
multiplication on
this field.
Symbol Value
a 0
b 1
... ...
z 25
A 26
B 27
... ...
T 45
U 46
Page 2 of 3
Addition on a finite field: +
For this operation, for each array position find the sum of the two
integers and if the result is larger than
46 find the remainder when the quotient is 47. That is, find (? +
?) ??? 47. For example, if the user
enters:
> abc+bbc
the result that should be printed is
'abc' + 'bbc' => 'bce'
> tuvwx+CBAzy
'tuvwx' + 'CBAzy' => 'aaaaa'
For this example the first string is longer than the second (the
'e' in orange). The output corresponding
to this extra symbol is 'E':
> orange+white
'orange' + 'white' => 'KyiGkE'
Multiplication on a finite field: *
This operation is handled the same way as addition but uses modular
multiplication. That is, find
(? × ?) ??? 47.
> abcqH*AUydkzAB
the result that should be printed is
'abcqH' * 'AUydkzAB' => 'aUbbbZab'
> yyyyyyyyyyyy*abcdefghijkl
the result that should be printed is
'yyyyyyyyyyyy' * 'abcdefghijkl' => 'aybzcAdBeCfD'
Inversion on a finite field: /
For this operation, given two numbers X / Y, find a number Z such
that ? = (? × ?) ??? 47. However,
if Y is zero, then this operation is undefined, so set the output
to zero.
> abcqHU/Aabdk
the result that should be printed is
'abcqHU' / 'Aabdk' => 'aacviu'
> bbbbb/ABCDU
the result that should be printed is
'bbbbb' / 'ABCDU' => 'MhQnU'
In: Computer Science
MATLAB
Create a function that prints a string of perfect cubes between (m,n). Include any reasonable error statements such as decimals and negative numbers.
In: Computer Science