Question

In: Computer Science

1. Write pseudocode for the following program. You do not have to write actual C++ code....

1. Write pseudocode for the following program. You do not have to write actual C++ code.

Assume you have a text file, that has been encrypted by adding 10 to the ASCII value of each character in the message. Design a decryption program that would reverse this process, and display the original message to the console.to the new array.

2.Write the code for the specified program. Use proper style and naming. Test and upload your code as a CPP file.

Write a program that keeps track of a speakers’ bureau. The program should use a structure to store the following data about a speaker: Name and Fee Required.

The program should use an array of at least 10 structures. It should let the user enter data into the array, and then display the lowest fee of any of the speakers. Use a modular design for your program (separate functions for input and processing).

Solutions

Expert Solution

#include <iostream>
using namespace std;

//constructing speaker using structure
struct speaker{
        string name;
        double fee;
};

//to take the speaker name and fee from user and store them in array arr
void takeInput(struct speaker arr[],int size){
        string name;
        double fee;
        for(int i=0;i<size;i++){
                cout<<"Please enter the name of speaker :"<<endl;
                cin>>name;
                arr[i].name=name;
                cout<<"Please enter the fee of speaker :"<<endl;
                cin>>fee;
                arr[i].fee=fee;

        }
}

//main 
int main(){
        
        int min;
        //creating array of structure
        struct speaker arr[10];
        
        //calling takeInput() to take input
        takeInput(arr,10);
        
        //assigning the first speaker fee in min variable
        min=arr[0].fee;
        
        
        cout<<"Finding the speaker having the lowest fee..."<<endl;
        
        //finding the lowest fee of any of the speakers
        for(int i=1;i<10;i++){
                if(arr[i].fee<min){
                        min=arr[i].fee;
                }
        }
        //printing the lowest fee
        cout<<"The lowest fee of any of the speakers is "<<min;
}

This is a C++ code that keeps track of a speakers’ bureau.

Sample Input and output:

Please enter the name of speaker :
John
Please enter the fee of speaker :
120
Please enter the name of speaker :
James
Please enter the fee of speaker :
140
Please enter the name of speaker :
Rob
Please enter the fee of speaker :
130
Please enter the name of speaker :
Ronald
Please enter the fee of speaker :
150
Please enter the name of speaker :
Beakley
Please enter the fee of speaker :
65
Please enter the name of speaker :
Jeff
Please enter the fee of speaker :
210
Please enter the name of speaker :
Robin
Please enter the fee of speaker :
170
Please enter the name of speaker :
Mett
Please enter the fee of speaker :
190
Please enter the name of speaker :
Dennis
Please enter the fee of speaker :
200
Please enter the name of speaker :
Rey
Please enter the fee of speaker :
250
Finding the speaker having the lowest fee...
The lowest fee of any of the speakers is 65

Code screenshots:

Code Output:

Pseudocode of problem #1

Pseudocode explainations:

Here we just read each characters from the text file one by one and have updated it's ASCII value as

'ch' = 'ch' - 10

As we are doing decryption which is just a reverse process of encryptoin in which we have encrypted the textFile character of message by adding 10 to the ASCII value of each character of message.

Here in decrption we have to decrement 10 from the ASCII value of each character in the message of textFile so that we will obtain the original message.

for example let's have the message in textFile as :

HELLO.

Here characters are : {H,E,L,L,O}

ASCII Values are:

H - 72

E - 69

L - 76

L - 76

0 - 79

Now after applying encryption the message will become:

H - 72 + 10 = 82 = R

E - 69 + 10 = 79 = O

L - 76 + 10 = 86 = V

L - 76 + 10 = 86 = V

0 - 79 + 10 = 89 = Y

=>ROVVY

Now we will apply our decryption on ROVVY as:

R - 82-10=>72 - H

O - 79-10=>69 - E

V - 86-10=>76 - L

V - 86-10=>76 - L

Y - 89-10=>79 - O

So in this way our decryption function will work...


Related Solutions

write pseudocode for the following problems not c code Pseudocode only Write a C program to...
write pseudocode for the following problems not c code Pseudocode only Write a C program to print all natural numbers from 1 to n. - using while loop Write a C program to print all natural numbers in reverse (from n to 1). - using while loop Write a C program to print all alphabets from a to z. - using while loop Write a C program to print all even numbers between 1 to 100. - using while loop...
Using the pseudocode found below, write only the actual (C++) code for this program. Include all...
Using the pseudocode found below, write only the actual (C++) code for this program. Include all libraries. Specification: Write a program that will repeatedly ask the user for quiz grades in the range from 0 to 20. Any negative value will act as a sentinel. When the sentinel is entered compute the average of the grades entered. Design: Constants None Variables float grade float total = 0 int count = 0 float average ------- Inital Algorithm Repeatedly ask user for...
write pseudocode not c program If- else programming exercises 1.    Write a C program to find...
write pseudocode not c program If- else programming exercises 1.    Write a C program to find maximum between two numbers. 2.    Write a C program to find maximum between three numbers. 3.    Write a C program to check whether a number is negative, positive or zero. 4.    Write a C program to check whether a number is divisible by 5 and 11 or not. 5.    Write a C program to check whether a number is even or odd. 6.    Write...
C Program and pseudocode for this problem. Write a C program that plays the game of...
C Program and pseudocode for this problem. Write a C program that plays the game of "Guess the number" as the following: Your program choose the number to be guessed by selecting an integer at random in the rang of 1 to 1000. The program then asks the use to guess the number. If the player's guess is incorrect, your program should loop until the player finally gets the number right. Your program keeps telling the player "Too High" or...
For this assignment you will develop pseudocode and write a C++ program for a simple calculator....
For this assignment you will develop pseudocode and write a C++ program for a simple calculator. You will create both files in Codio. Put your pseudocode and C++ code in the files below. PSEUDOCODE FILE NAME: Calculator.txt C++ SOURCE CODE FILE NAME : Calculator.cpp DESCRIPTION: Write a menu-driven program to perform arithmetic operations and computations on a list of integer input values. Present the user with the following menu. The user will choose a menu option. The program will prompt...
You are to write a program in C to do the following in a loop for...
You are to write a program in C to do the following in a loop for the KL46Z . Prompt the user for a positive integer greater than 1 and sanity-check the input. If the number is a prime number, it is to be printed on a new line in red text. If the number is evenly divisible by 7, it is to be printed on a new line in green text. If the current number is evenly divisible by...
Using pseudocode or C++ code, write code to print “small” if the magnitude M of an...
Using pseudocode or C++ code, write code to print “small” if the magnitude M of an earthquake is in the range [0, 3), “medium” if M is in the range [3, 6), “large” if M is in the range [6, 9) and “epic” if M is greater than or equal to 9, where M is input by a user via the keyboard. (in c++)
write the pseudocode and code to solve the following: you are given a list. determine the...
write the pseudocode and code to solve the following: you are given a list. determine the sum of all the elements in the list without using the built in puthon function sum(). Take your code and create your own function and name it my_sum_algo() which will return the sum of numbers PS please write comments in the code for my understanding, and please write jn jn PYTHON 3 languge. Thank you, have a great day !
Please write variables and program plan(pseudocode) of this C++ programming code: #include <iostream> using namespace std;...
Please write variables and program plan(pseudocode) of this C++ programming code: #include <iostream> using namespace std; void leapYear(int x); int main() { int x; cout << "Enter a year: "; cin >> x; leapYear (x);   return 0; } void leapYear(int x ) {    if (x % 400 == 0)    {    cout << "This is a leap Year";}    else if    ((x % 4 == 0) && (x % 100 != 0))    {    cout <<...
Write a program in c++ to do the following : (1) Declare an array a of...
Write a program in c++ to do the following : (1) Declare an array a of size 10 and three pointer variables p, q, and v. (2) Write a loop to fill array a with values 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 (3) write following statement: p= &a[2]; q = &a[5]; i = *q - *p; cout<<“The value of i is”<< i; i = *p - *q; cout<<“The value of i is %d”<< i; 4) assign...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT