Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment

1. Write a program that takes two arguments, two positive integers m and n such that m < n, and prints the sum m + ( m + 1) + • • • + n.

2. Write a program that prints the range of a sequence of integers provided through stdin. For example, the range of -3, 15, -8, 29, 17 is 29 - (-8) = 37.

3. Write a program according to the following specification:

a. It has two possible command-line arguments: -s indicates "shout" mode, while -w indicates "whisper" mode.
b. It reads an arbitrary list of strings from stdin.
c. It writes the strings to stdout, except that it writes all letters in either uppercase or lowercase according to the mode.

4. Write a program according to the following specification:

a. It reads an arbitrary list of strings from stdin.
b. It records the number of vowels encountered.
c. It prints the number of occurrences of each vowel to stdout.

5. Write a program, called hide, according to the following specification:

a. It has two possible arguments: -encrypt indicates encryption mode, while -decrypt indicates decryption mode.

b. It reads an arbitrary list of strings from stdin.

c. It applies a cypher to the strings. You may invent your own, but a simple one is to shift the letters by a constant amount (for example, 'a' becomes 'd', and 'z' becomes 'c'). It either encrypts or decrypts the strings ("shifts" or "deshifts" the letters) depending on the mode.

d. It prints the encrypted or decrypted text to stdout.

e. At minimum, it should be able to handle text consisting only of lowercase letters. For example, if the message attention home planet stop prepare invasion stop earth is ripe for the taking stop cu soon full stop is in file msg.txt, then $ ./hide -encrypt < msg.txt > msge.txt would produce the following cyphertext in file msge.txt if hide is using a shift of 12: mffqzfuaztayqbxmzqfefabbdqbmdquzhmeuazefabqmdftuedubq rad ftqfmwuzsefabogeaazrgxxefab.

f. Then $ ./hide -decrypt < msge.txt would yield the original message. Using Unix piping would also result in the output of the original message: $ ./hide -encrypt < msg.txt | ./hide -decrypt To achieve the proper shift, use the following formula: 'a' + (((c - 'a') + sh) % 26) The idea is to find c's position in the alphabet (c - 'a'), add the shift ((c - 'a') + sh) modulo 26 (((c - 'a') + sh) % 26), and finally translate the character back into the ASCII range for lowercase letters. To unshift, set sh to 26 - sh and use the same formula. For example, if sh is 12, then 'a' + (((c - 'a') + 12) % 26) yields 'q' if c == 'e' since 'q' is 12 characters later than 'e'; and 'f' if c == 't' since 'f' is 12 characters later than 't' modulo 26.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92724320

Have any Question?


Related Questions in Computer Engineering

For the following c statement what is the corresponding

For the following C statement, what is the corresponding RISC-V assembly code? Assume that the variables f, g, h, and i are given and could be considered integers as declared in a C program. Use a minimal number of assem ...

Are there manufacturers and retailers who have taken steps

Are there manufacturers and retailers who have taken steps to reduce their pollution impact, both air quality and industrial pollution, while maintaining a viable place in the market?

Question suppose you have a class whose objects are very

Question : Suppose you have a class whose objects are very, very large. Briefly, describe the advantages and drawbacks of call-by-value and call-by-reference for large objects. Describe a parameter passing mechanism that ...

Question reflect on a system that you have analyzed

Question : Reflect on a system that you have analyzed, designed and manufactured in the past. Address the following: Summarize your selected software system to provide context for your colleagues. Summarise the methodolo ...

In simple python form pleasewrite a script that asks the

In Simple Python form please: Write a script that asks the user to input the name of a file, opens the file, reads its contents, prints the contents of the file on the screen, and closes the file. If no such file exists, ...

Suppose you are asked to automate the prescription

Suppose you are asked to automate the prescription fulfillment system for a pharmacy, MailDrugs. When an order comes in, it is given as a sequence of requests, "x1 ml of drug y1," "x2 ml of drug y2," "x3 ml of drug y3," ...

Question 1 complete the lab 9-5 programming challenge 1 --

Question: 1. Complete the Lab 9-5, "Programming Challenge 1 -- Going Green," of Starting Out with Programming Logic and Design. Note: You are only required to create the flowchart for this activity; however, notice how t ...

Quesiton for completion of the program use arrays and

Quesiton: For completion of the program, use arrays and files. Instead of prompting the user for the prices of the book, update the website program to reflect the following changes: • Read the prices into an array from a ...

Assume a normal distribution for n 300 how many cases

Assume a normal distribution for N = 300. How many cases would one expect to find between +1 and -1 standard deviations around the mean?

Question summary of what is legal and regulatory

Question : Summary of what is legal and regulatory obligations regarding data and information security. Summary of project initiation in the technology world.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As