Question
please write psedocodes for all of the questions and an algorithm for 2. no coding is required .

FIUJELI 95 PIOL 1. (Geometry: Area of a Pentagon) Write a C# program that prompts the user to enter the length from the cente
my... Project 95 Pro 3. (Decimal to Hex) Write a pseudocode and C++ program that prompts the user to enter an integer between
5. (Student Major and Status) Write a CH program that prompts the user to enter two characters and displays the major and sta
6. (Check SSN) Write a CH+ program that prompts the user to enter a Social Security Number in the format ddd-dd-dddd, where d
0 0
Add a comment Improve this question Transcribed image text
Answer #1

At a time we can answer only four questions , so answering first four questions :

Note: for algorithms and code explanations , please find the comments

=====================================================================

//1-----------------------------------------------------------------------------

#include <iostream>

#include <cmath>                    //form math functions like sin() cos()

using namespace std;

int main()

{

    float r;

    cout<<"Enter length of center of pentgon to vertex:";

    cin>>r;

    float s = 2 * r * sin(M_PI/5);  //implementing side formula ; M_PI is a constant defined by cmath library

    float area = (5 * (s*s))/(4 * tan(M_PI/5)); //implementing area formula

    printf("%.2f", area);           //rounding upto 2 digits

    

    return 0;

}

//2-------------------------------------------------------------------------------

//algo

//1)putting 3 cities in an array

//iterating over the array

//starting iteration from 1

//comparing each element with the previous one

//if prev element is lesses than the next one , then swap

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

    string city_container[3];

    cout<<"Enter cisy 1:";

    cin>>city_container[0];

    cout<<"Enter city 2:";

    cin>>city_container[1];

    cout<<"Enter city 3:";

    cin>>city_container[2];

    for (unsigned int i = 1; i < 3; ++i)

    {

        if (city_container[i] <= city_container[i - 1])

        {

            std::swap(city_container[i - 1], city_container[i]);

            i = 0;

        }

    }

    for(int i=0;i<3;i++){

        cout<<city_container[i]<<"\n";

    }

    return 0;

}

//3-----------------------------------------------------------------------


//Store the remainder when the number is divided by 16 in a temporary variable temp. If temp is less than 10, insert (48 + temp) in a character array otherwise if temp is greater than or equals to 10, insert (55 + temp) in the character array.

//Divide the number by 16 now

//Repeat the above two steps until the number is not equal to 0.

//Print the array in reverse order now.

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

    int n;

    cout<<"Enter the number";

    cin>>n;

    // char array to store hexadecimal number

    char hexaDeciNum[100];

      

    // counter for hexadecimal number array

    int i = 0;

    while(n!=0)

    {    

        // temporary variable to store remainder

        int temp  = 0;

          

        // storing remainder in temp variable.

        temp = n % 16;

          

        // check if temp < 10

        if(temp < 10)

        {

            hexaDeciNum[i] = temp + 48;

            i++;

        }

        else

        {

            hexaDeciNum[i] = temp + 55;

            i++;

        }

          

        n = n/16;

    }

    cout<<"The hex value is:";

    // printing hexadecimal number array in reverse order

    for(int j=i-1; j>=0; j--)

        cout << hexaDeciNum[j];

    return 0;

}

//4------------------------------------------------------------------

#include <iostream>

using namespace std;

int main()

{

    

   char x ;

   cout<<"Enter the Character";

   cin>>x;

   switch (x)

   {

       case 'A': printf("Corresponding number  is 2");

               break;

       case 'B': printf("Corresponding number  is 2");

               break;

       case 'C': printf("Corresponding number  is 2");

               break;

       case 'D': printf("Corresponding number  is 3");

               break;

       case 'E': printf("Corresponding number  is 3");

               break;

       case 'F': printf("Corresponding number  is 3");

               break;

       case 'G': printf("Corresponding number  is 4");

               break;

       case 'H': printf("Corresponding number  is 4");

               break;

       case 'I': printf("Corresponding number  is 4");

               break;

       case 'J': printf("Corresponding number  is 5");

               break;

       case 'K': printf("Corresponding number  is 5");

               break;

       case 'L': printf("Corresponding number  is 5");

               break;

       case 'M': printf("Corresponding number  is 6");

               break;

       case 'N': printf("Corresponding number  is 6");

               break;

       case 'O': printf("Corresponding number  is 6");

               break;

       case 'P': printf("Corresponding number  is 7");

               break;

       case 'Q': printf("Corresponding number  is 7");

               break;

       case 'R': printf("Corresponding number  is 7");

               break;

       case 'S': printf("Corresponding number  is 7");

               break;

       case 'T': printf("Corresponding number  is 8");

               break;

       case 'U': printf("Corresponding number  is 8");

               break;

       case 'V': printf("Corresponding number  is 8");

               break;

       case 'W': printf("Corresponding number  is 9");

               break;

       case 'X': printf("Corresponding number  is 9");

               break;

       case 'Y': printf("Corresponding number  is 9");

               break;

       case 'Z': printf("Corresponding number  is 9");

               break;

       default: printf("Invalid option");

                break;   

   }

   return 0;

}

Add a comment
Know the answer?
Add Answer to:
please write psedocodes for all of the questions and an algorithm for 2. no coding is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that prompts the user to enter two characters and displays the major and status represented in the characters.

    Write a program that prompts the user to enter two characters and displays the major and status represented in the characters. The first character indicates the major and the second is number character 1, 2, 3, 4, which indicates whether a student is a freshman, sophomore, junior, or senior. Suppose the following characters are used to denote the majors: M: MathematicsC: Computer Science T: Testing and Certification

  • Please write code in C++ and include all headers not bits/stdc: 17.10 (Occurrences of a specified...

    Please write code in C++ and include all headers not bits/stdc: 17.10 (Occurrences of a specified character in a string) Write a recursive function that finds the number of occurrences of a specified letter in a string using the following function header. int count(const string& s, char a) For example, count("Welcome", 'e') returns 2. Write a test program that prompts the user to enter a string and a character, and displays the number of occurrences for the character in the...

  • USING PYTHON LANGUAGE. QUESTION I: Write a program that displays the following table: a a^2 a...

    USING PYTHON LANGUAGE. QUESTION I: Write a program that displays the following table: a a^2 a 3 a14 1 1 1 1 2 4 8 16 3 9 27 81 4 16 64 256 QUESTION II: An approximate value of a number can be computed using the following formula: 7 ) Write a program that displays the result of 4 X + 7 • H) and 4 X - 를 7 tis). 9 QUESTION III: Write a program that prompts...

  • Q4. Write an algorithm, draw the flowchart and write a C++ program to • Read the...

    Q4. Write an algorithm, draw the flowchart and write a C++ program to • Read the Number and Letter from the user • Check the number and letter then print the corresponding month name as given in Table Q4 using IF ELSE STATEMENT. Table: Q4 Number and Letter Month Name JANUARY 2 F FEBRAURY 3 M MARCH 4 A APRIL Other numbers Invalid Input 1J Sample Output: Enter the value of number:1 Enter the value of letter:) JANUARY Algorithm: Flowchart:...

  • in C++ please. (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and U/u as the vowels...

    in C++ please. (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and U/u as the vowels Write a program that prompts the user to enter a letter and check whether the letter is a vowel or consonant. Here is a sample run: 4.10 Enter a letter: B B is a consonant -Enter Enter a letter grade: a is a vowel Enter Enter a letter grade: # is an invalid input Enter (Vowel or consonant?) Assume letters A/a, E/e, I/i,0/o, and...

  • Write a program that prompts the user to enter a file name and displays the occurrences...

    Write a program that prompts the user to enter a file name and displays the occurrences of each letter in the file. Letters are case-insensitive. Here is a sample run: Enter a filename: Lincoln.txt Number of A’s: 23 Number of B’s: 0 Number of C’s: 12 …… Number of Y’s: 5 Number of Z’s: 7

  • Write Java program: • Is at least 8 characters long • Contains at least 1 lower letter charact...

    Write Java program: • Is at least 8 characters long • Contains at least 1 lower letter character • Contains at least 1 upper letter character • Contains at least 1 numeric digit • Contains at least 1 special character from the set: !@#$%^&* • Does not contain the word “and” or the word “the” Prompts the user for a password, including the requirements above in your output. Output a string that states valid or invalid. If invalid, state which...

  • Vowel or Consonant?Write a program for Programming Exercise 4.10 on p.151 in the textbook. Testing: Run...

    Vowel or Consonant?Write a program for Programming Exercise 4.10 on p.151 in the textbook. Testing: Run the program for two vowels, two consonants, and two invalid characters. Assume letters A/a , E/e , I/i , O/o , U/u as the vowels. Write a program that prompts the user to enter a letter and check whether the letter is a vowel or constant.

  • 14.3: More Sentences Write a program that allows a user to enter a sentence and then...

    14.3: More Sentences Write a program that allows a user to enter a sentence and then the position of two characters in the sentence. The program should then report whether the two characters are identical or different. When the two characters are identical, the program should display the message: <char> and <char> are identical! Note that <char> should be replaced with the characters from the String. See example output below for more information. When the two characters are different, the...

  • A regular polygon is an n-sided polygon in which all sides are of the same length...

    A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon isArea =Here, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area. Here is a sample run:

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT