Ask Question, Ask an Expert

+1-415-315-9853

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

Figure is code to count the number of primes from 2 to n

Figure is code to count the number of primes from 2 to n, using the sieve method on a suitably large array a. That is, a[i] is TRUE at the end only if there is no prime p i or less that evenly divides i. We initialize al ...

Programming oneusing jgrasp and the software development

Programming One Using jGrasp and the Software Development Kit, write a program in response to the following prompt: Write a program that prompts the user to input three numbers. This program should then output the number ...

Assignment testing and quality assurancenote this is part

Assignment: Testing and Quality Assurance Note: This is part three of a four-part implementation plan that will be combined to form the finalized plan in Week Four. It is expected that adjustments will be made in the fin ...

Provide a recursive definition of some sequence of numbers

Provide a recursive definition of some sequence of numbers. Choose one different from that of any posted thus far. Write a recursive method that given n, computes the nth term of that sequence. Also provide an equivalent ...

Programdemonstrate the ability to create a program that

Program Demonstrate the ability to create a program that utilizes the Observer design pattern. Demonstrate the ability to create abstract classes and implement derived classes. Demonstrate the ability to create and itera ...

Question 1briefly explain these main programming paradigm

Question 1: Briefly explain these main programming paradigm (Logic, Functional, Object Oriented, Procedural, Imperative and Aspect-oriented), and for each of these paradigms name at least one language that can be used fo ...

1 devise a register-allocation strategy on the assumption

1. Devise a register-allocation strategy on the assumption that we automatically store all registers on the stack before each procedure call and restore them after the return. 2. Construct the register-interference graph ...

James wants to buy a motorcycleinstructions the following

James wants to buy a motorcycle Instructions: The following programming problem can be solved by a program that performs three basic tasks-Input Data, Process Data, and Output Results. Use RAPTOR to design a suitable pro ...

Assignment instructionsexception handlingfirst create three

Assignment Instructions Exception Handling First, create three exception classes named NumberHighException, NumberLowException, and NumberNegativeException. Both NumberHighException and NumberLowException should be direc ...

1 take into account the number of hours worked if the

1.) take into account the number of hours worked. If the hours is greater than 40, then calculate 1.5 times the rate times the hours over 40. Add the overtime pay to the regular pay, calculated by multiplying rate times ...

  • 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

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro