Create the algorithms in both flowchart and pseudocode form for the following two program requirements:
Given 100 item prices in an array called prices[100]. Create an algorithm that calculates the following two results: 1. Find the highest price in the array; and 2. Reduce that price of the highest by 10%
For a user that inputs 3 numbers, output those numbers in ascending order.

Answer :

mjassim

Answer:

Hello Brissap2814! This question has 3 parts. The first is asking you to print the highest price from an array of 100 prices. The easiest way to do this is to sort the array in ascending order, so that the highest value of the array becomes the last array element, which you can then simply print to the screen. The second part of the question is asking you to reduce the highest price that you got in the first part of the answer by 10%. Finally, the last part of the question is asking you to prompt a user to input 3 numbers and then print the numbers in ascending order. The requirements are to provide both Flowchart and Pseudocode algorithms for all 3 parts.  

Explanation:

1. Print highest price from array prices

 Algorithm: Pseudocode  

    highest_price = prices.sort.last

      OR    

    highest_price = prices.sort[100]

2.

 Algorithm: Pseudocode    

   reduced_price = highest_price – 10%  

   prices[100] = reduced_price

3.

 Algorithm: Pseudocode    

   // initialize empty array  

   input_array = []  

   // loop 3 times    

   for count in 0..2    

      prompt user input for number    

      handle exceptions for non-numeric input    

      save user input to input_array  

    end  

    // sort input array  

    input_array.sort  

    print input_array  

${teks-lihat-gambar} mjassim
${teks-lihat-gambar} mjassim
${teks-lihat-gambar} mjassim

Other Questions