Question

Design a program in pseudocode that asks the user to enter a string containing a series...

Design a program in pseudocode that asks the user to enter a string containing a series of ten single-digit numbers with nothing separating them. The program should display the sum of all the single digit numbers in the string except for the highest value digit. You may only use one main module and one sorting function; otherwise, do not modularize your program.

For example, if the user enters 5612286470, the sum would be 33. (0+1+2+2+4+5+6+6+7)

If there are multiple highest value digits then just leave out one of them... 0000000999 sum would be 9.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find below code containing 2 modules one for bubble sort and the other to compute total as per requirement, Sorting helps to eliminate last largest number and in main module we compare and exclude the repetition and consider only once for totaling. Please comment if more information required:

function sort(array ar)
{
   for i=0 to N-2
       for j=0 to N-2
           if(a(j)>a(j+1);
           temp=a(j);
           a(j)=a(j+1);
           a(j+1)=temp;
           end if
       end for
   end for
   return ar;
}

function main
{

   input string abc;
   abc = sort(abc);
   int total = 0;

   for (h=0;h<abc.count-2;h++)
   {
       if(string(h) is not equal to string(h+1) and string(h) is not equal to abc.count-2
       {
           total=total + convert.toinet32(abc(h));
       }
   }

   print total;
}

Add a comment
Know the answer?
Add Answer to:
Design a program in pseudocode that asks the user to enter a string containing a series...
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
  • c++ pleased Assignment 6a (15 points] - Character and String related processing... Listed below are two...

    c++ pleased Assignment 6a (15 points] - Character and String related processing... Listed below are two interesting programming challenges that will require a bit of character and/or string related processing with functions. (Carefully read the specifications for each programming challenge and select ONE.) (1) Sum of Digits in a String Write a program that asks the user to enter a series of single-digit numbers with nothing separating them. Read the input as a C-string or a string object. The program...

  • PLEASE HELP!!!I need help with the following JAVA PROGRAMS. Please ready carefully. So this comes from...

    PLEASE HELP!!!I need help with the following JAVA PROGRAMS. Please ready carefully. So this comes from tony gaddis starting out with java book. I have included the screenshot of the problems for reference. I need HELP implementing these two problems TOGETHER. There should be TWO class files. One which has TWO methods (one to implement problem 8, and one to implement problem 9). The second class should consist of the MAIN program with the MAIN method which calls those methods....

  • Design a program that asks the user to enter a series of 20 numbers. The program...

    Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in the array and then display the following data: The lowest number in the array The highest number in the array The total of the number in the array The average of the numbers in the array PLEASE GIVE THE PSEUDOCODE AND CODE IN C PROGRAMMING

  • Write a program that asks the user to enter a string and then asks the user...

    Write a program that asks the user to enter a string and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the string. python programming

  • Write a program in Python that asks the user for the ISBN of the book in...

    Write a program in Python that asks the user for the ISBN of the book in the format xxx-x-xxx-xxxxx-x. To validate: Initialize a total to 0 Have the program remove the dashes so that only the 13 digits are left in the ISBN string for each index of the first 12 digits in the 13 digit ISBN string get the digit at the current index as an integer If the current index is an even number, add the digit to...

  • in C++, Design a program that asks the user to enter a password, and then analyze...

    in C++, Design a program that asks the user to enter a password, and then analyze the password, and then analyze the password for the following weaknesses: 1. Fewer than 8 characters 2. Does not contain at least one uppercase letter and one lowercase latter 3. Does not contain at least one numeric digit 4. Does not contain at least one special character( a character that is not a letter or numeric digit) 5. Is a sequence of consecutive uppercase...

  • Extra Credit Assignment 4 Write a PYTHON program that asks the user to enter a series...

    Extra Credit Assignment 4 Write a PYTHON program that asks the user to enter a series of numbers. You can decide how many numbers to enter or the user can. As the user enters each number, add it to a list. After all the numbers are added, determine: What is the highest number in the list What is the lowest number in the list What is the sum of all the numbers in the list No error checking is required....

  • Write a python program that does the following. a. It asks the user to enter a...

    Write a python program that does the following. a. It asks the user to enter a 5-digit integer value, n. b. The program reads a value entered by the user. If the value is not in the right range, the program should terminate. c. The program calculates and stores the 5 individual digits of n. d. The program outputs a “bar code” made of 5 lines of stars that represent the digits of the number n. For example, the following...

  • Total Sales Design a program that asks the user to enter a store’s sales for each...

    Total Sales Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored in an array. Use a loop to calculate the total sales for the week and display the result. Need: variable lists, IPO Chart, pseudocode, Flowchart, and working Python code. 2. Lottery Number Generator Design a program that generates a 7-digit lottery number. The program should have an Integer array with 7 elements. Write a loop...

  • Project 1, Program Design 1. Write a C program replace.c that asks the user to enter...

    Project 1, Program Design 1. Write a C program replace.c that asks the user to enter a three-digit integer and then replace each digit by the sum of that digit plus 6 modulus 10. If the integer entered is less than 100 or greater than 999, output an error message and abort the program. A sample input/output: Enter a three-digit number: 928 Output: 584 2. Write a C program convert.c that displays menus for converting length and calculates the result....

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