Question

Write the pseudocode below as a working Python program. Take a screenshot of your code and...

  1. Write the pseudocode below as a working Python program. Take a screenshot of your code and output and paste into your answer document. User input of ‘y’ or ‘Y’ should cause the loop to continue.

   // Constant for the commission rate

   // Declare as a global variable

   Constant Real COMMISSION_RATE = 0.10

    Module main()

       // Local variable

        Declare String keepGoing = "y"

        // Calculate as many commissions

        // as needed.

        While keepGoing == "y"

           // Display a salesperson's commission.

           Call showCommission()

           // Do it again?

           Display "Do you want to calculate another"

           Display "commission? (Enter y for yes.)"

           Input keepGoing

        End While

    End Module

    // The showCommission module gets the

    // amount of sales and displays the

    // commission.

    Module showCommission()

        // Local variables

        Declare Real sales, commission

        // Get the amount of sales.

        Display "Enter the amount of sales."

        Input sales

        // Calculate the commission.

        Set commission = sales * COMMISSION_RATE

        // Display the commission

        Display "The commission is $", commission

    End Module

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here I am sending code, screens of code and output. Refer the screens for better visualize. If any queries comment below. Thank you.

Code:

COMMISSION_RATE = 0.10#gobal variable

def showCommission():#showCommission module
sales = int(input("Enter the amount of sales.: ")) #reading the amount of sales.
comission = sales * COMMISSION_RATE #calculating commission.
print("The commission is $",comission) #printing the commission.

keepGoing = "y" #local variable.
while keepGoing == "y" or keepGoing == "Y": #checking the condition is input is y or not.
showCommission() #calling the showCommission.
print("\nDo you want to calculate another.")
keepGoing = str(input("commission?(Enter y for yes): "))#asking the user for calculate another.

Add a comment
Know the answer?
Add Answer to:
Write the pseudocode below as a working Python program. Take a screenshot of your code and...
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
  • PYTHON Programming Exercise 2: Create a Simple Cost Calculator Write a program that displays input fields...

    PYTHON Programming Exercise 2: Create a Simple Cost Calculator Write a program that displays input fields (item name and cost) and calculates and displays the calculated costs. The program should do the following: Provide data entry areas for item name and cost. Calculate and display the subtotal of all items. Adds a sales tax of 6% and calculate and displays the total cost. Enter the following values into your program. Mother Board $200. RAM $75. Hard Drive $72. Video Graphics...

  • Hello! I'm looking for help with this assignment. Complete a program in pseudocode and Python that...

    Hello! I'm looking for help with this assignment. Complete a program in pseudocode and Python that performs the following tasks. Open the file called M4Lab1ii.py linked below these instructions in your M4 Content module in IDLE. Save as M4Lab1ii.py. Replace ii with your initials. [example for someone with the initials cc: M4Lab1cc.py] Complete Steps 1-7 as requested within the code’s comments. Run your program and test all four calculations, then exit the program. Save your program as M4Lab1ii.py using your...

  • Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a...

    Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the...

  • Look at this partial class definition, and then answer questions a - b below: Class Book...

    Look at this partial class definition, and then answer questions a - b below: Class Book    Private String title    Private String author    Private String publisher    Private Integer copiesSold End Class Write a constructor for this class. The constructor should accept an argument for each of the fields. Write accessor and mutator methods for each field. Look at the following pseudocode class definitions: Class Plant    Public Module message()       Display "I'm a plant."    End Module...

  • Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that...

    Overview Module 3 Assignment 1 features the design of a pseudocode and a Python program that uses iteration to guess a number from 1 to 10. Each lab asks you to write pseudocode that plans the program’s logic before you write the program in Python and to turn in three things: 1) the pseudocode, 2) a screenshot of the output, and 3) the Python program. Instructions Write pseudocode for a Python program that uses iteration to guess a number from...

  • When breaking a problem down, you often encounter elements that you want to use repeatedly in...

    When breaking a problem down, you often encounter elements that you want to use repeatedly in your code. Sometimes it's appropriate to write a new function; at other times it's appropriate to write a loop. What do you think? What kinds of circumstances would lead you to writing a function versus using a loop? What is the error in the pseudocode below? Re-write the pseudocode in your answer document. Declare Boolean finished = False Declare Integer value, cube While NOT...

  • Overview Module 3 Assignment 2 features designing a program using pseudocode and then completing the program...

    Overview Module 3 Assignment 2 features designing a program using pseudocode and then completing the program in Python using strings. M3Lab2 asks you to write a Mortgage Loan Calculator. Each lab asks you to write pseudocode that plans the program’s logic before you write the program in Python and to turn in three things: 1) the pseudocode, 2) a screenshot of the output, and 3) the Python program. Instructions Pseudocode and Python Program with Strings M3Lab2.txt has some of the...

  • I am supposed to a pseudocode function named max that accepts two integer values as arguments...

    I am supposed to a pseudocode function named max that accepts two integer values as arguments and returns the value that is greater of the two. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is greater of the two. Is everything correct and complete? //Pseudocode //This function takes two integers as parameters: x and y Begin : Max(x,y) If(x>y) then MAX=x Else MAX=y End if Return...

  • I have this code and need this to be written and applied with an array? How...

    I have this code and need this to be written and applied with an array? How do I process this? Also What would I apply this with flowchart? Module main()   Call getDailyProfit()   Call calculateWeeklyProfit() Call main() Module getDailyProfit()   // Declare all variables and establish the array          Constant Real SIZE = 7          Declare String days[SIZE] = Sunday, Monday, Tuesday, Thursday. Friday, Saturday          Declare Real days          Declare Real number          Declare Real Index             //Prompt the user for profit information for Sunday          Display...

  • I have this code and need this to be written and applied with an array? How do I process this? Also What would I apply t...

    I have this code and need this to be written and applied with an array? How do I process this? Also What would I apply this with flowchart? Module main()   Call getDailyProfit()   Call calculateWeeklyProfit() Call main() Module getDailyProfit()   // Declare all variables and establish the array          Constant Real SIZE = 7          Declare String days[SIZE] = Sunday, Monday, Tuesday, Thursday. Friday, Saturday          Declare Real days          Declare Real number          Declare Real Index             //Prompt the user for profit information for Sunday          Display “How...

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