Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

rite two C programs. First program (encrypt.c) executes a Caesar cipher, which used to encrypt text messages in the files. Second program (team.c) maintains information for the soccer team. Data in your team would be stored in the memory with the use of a linked list, with list nodes representing players.

A. Caesar’s Cipher for Files

prepare the C program “encrypt.c” which encrypts the message using one of an oldest known encryption techniques,called Caesar cipher, attributed to Julius Caesar. It involves replacing each letter in the message with another letter which is the fixed number of positions later in a alphabet (shift). If replacement will go past the letter Z, the cipher “wraps around” to the starting of the alphabet. like, if each letter is replaced by a letter two positions after it (shift by 2), then A will be replaced by a letter C, Y will be replaced by a letter A, and Z will be replaced by a letter B. Program must get two arguments:

(a) name of a file containing message to be encrypted and

(b) shift amount as the valid integer from 1 to 25 (inclusive).

Here’s the ex of a call to the program:

$ ./encrypt message.txt 3

Program then prepares encrypted message to new file with similar name but the added extension of .enc. In ex given above, original file name is message.txt, so encrypted message would be stored in a file named message.txt.enc.

You might suppose that:

• There is no limit on size of the file to be encrypted or on the length of each line in the file.

• Characters other than letters must be left analtered.

• Lower-case letters remain lower-case and upper-case letters remain upper-case.

Notice that program could also be used to decrypt a message if the user knows the original key by providing the encrypted message and using as shift amount 26 minus the original key. As an ex:

$ ./encrypt message.txt.enc 23

B. Linked Lists

prepare a C program “team.c” which maintains information for a soccer team. The program would permit you to add and delete players from your team, to search your team for players by name or by value they are worth, and to print out part or all of the team.

The data in your team would be stored in memory with the help of a linked list, with list nodes representing players. Each node would contain members for storing a player’s family name (char *) and first name (char *), their position (char) and their value (int). There are four possible positions, each of which is identified by the first character in the words (G)oalkeeper, (D)efender, (M)idfielder and (S)triker. Your linked list should be kept in a special order, with all goalkeepers first, then defenders, then midfielders, and at last the strikers. If there is more than one player in same position, then players must be kept in order of their insertion (e.g., the last defender in the team, must be the defender most recently inserted into the list; the first striker in the team must be the striker that was inserted first into list, and so on). You might suppose that no two players that assume the same position in your team have same family name.
Your program must be menu driven, with user being offered a choice of the six commands described below:

• Insert new player into a team. Program must prompt user for the new family name and first name, a position and a value. This information must be placed in new node that has been created using malloc function. And then node must be inserted at a suitable position in the linked list which stores the team data. Do not forget that team should be stored in special order, by considering the player’s position first, and then (if needed) the order of insertion. If the node with given family name is already in a team, an error message must be produced and new node must not be inserted into a linked list.

• Delete player from the team. Program must prompt the user for the family name of the player to be deleted and then delete node containing that family name from the linked list which stores the team. If no player with the given family name is found in the team, an error message must be produced.

• Search for the player using input family name. Program must print the family name, first name, position and value of the player, with each piece of information on a separate line. If no player with given family name is found in the team, an error message must be produced.

• Search for players in team which are worth less than or equal to an input value. Program must print family name, first name, position and value of any player which is worth less than or equal to the input value, with information of each player on the separate line. Blank line must be printed between each player (if more than one is found). If no player in team is worth less than or equal to the given value, the error message must be produced.

• Print team, following special order. Print family name, first name, position and value of each player, with each piece of information on separate line. A blank line must be printed between each player. Special order supposes that goalkeepers appear first, then defenders, then midfielders, and at last strikers. If there are more than one players of same position, then they must be printed in order of their insertion.

• Quit program. When a program is given the quit command, it must delete all nodes in linked list by using calls to free function. It must then try to print linked list.

It is suggested that you finish and test each step before moving on to next one. This way, if the program no longer works, you would know which statements are causing an error.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91865

Have any Question?


Related Questions in Programming Language

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

  • 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