Concept explainers
A group of statements that exist within a
- a. block
- b. parameter
- c. module
- d. expression
A module is a group of statement that is present in a program in order to perform specific tasks.
Hence, the correct answer is option “C”.
Explanation of Solution
Module:
- A module is a group of statement that is present in a program in order to perform specific tasks.
- Module is used to reduce complexity of a program. Instead of writing a large complex program, it can be divided into small chunks, each one performing particular part of the task.
- The approach of dividing a program into smaller chunks is called as “divide and conquer” because; a large program is divided into smaller tasks that can be easily performed.
- Module is also called as function.
- Single program contains more than one module.
Syntax:
In Python, function is written as;
#Function name
def function_Name(parameters):
#statements
Explanation for incorrect options:
Block:
Block is a piece of program which is executed as a unit in a module.
Hence, the option “A” is wrong.
Parameter:
Parameter is a part of program, where the information is sent from one module to other module.
Hence, option “B” is wrong.
Expression:
An expression contains operators, operands and values in a combined form and they are evaluated.
Hence, the option “D” is wrong.
Want to see more full solutions like this?
Chapter 3 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- **using C# and visual studio design a program to satisfy the below problem** Create an application that generates two random integers, each in the range of 100 through 500. The numbers should be displayed as addition problems on the application’s form, such as The form should have a text box for the user to enter the problem’s answer. When a button is clicked, the application should do the following: Check the user’s input and display a message indicating whether it is the correct answer. Generate two new random numbers and display them in a new problem on the form.arrow_forwardUser Defined Function: Void Function Create a JAVA program that will add, subtract, multiply and divide two numbers. Use user defined function for each operator Any number divided by zero will result to undefined Use int or double data type only for all variables declaredEXPECTED OUTPUT:arrow_forward**using C# and Visual Studio design a program to satisfy the below problem** Create an application that generates a random number in the range of 1 through 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” If the user guesses the number, the application should congratulate the user and then generate a new random number so the game can start over. Optional Enhancement: Enhance the game so it keeps count of the number of guesses that the user makes. When the user correctly guesses the random number, the program should display the number of guesses.arrow_forward
- 1. Design and implement an application that reads an integer value representing a year input by the user. The purpose of the program is to determine if the year is a leap year (and therefore has 29 days in February) in the Gregorian calendar. A year is a leap year if it is divisible by 4, unless it is also divisible by 100 but not 400. For example, the year 2003 is not a leap year, but 2004 is. The year 1900 is not a leap year because it is divisible by 100, but the year 2000 is a leap year because even though it is divisible by 100, it is also divisible by 400. Produce an error message for any input value less than 1582 (the year the Gregorian calendar was adopted). 2. Modify the solution to the previous project (i.e., Leap year) so that the user can evaluate multiple years. Allow the user to terminate the program using an appropriate sentinel value. Validate each input value to ensure it is greater than or equal to 1582.arrow_forwardPlease in Java programming languagearrow_forwardplease help with the python pseudo codearrow_forward
- Us------c. Prak 9 Instructions PDF -mming Prak 9 Chapter 6: Modularizing Your Code with Methods 1. Salesperson's Commission Calculator (Nr 1, Page 408) Create an application that lets the user enter a salesperson's revenue sale and the rate of commission paid by the company, and display the commission earned. For example: • If a salesperson sells $100,000 in revenue while working with a company that pays 5 percent of the revenue, his/her commission check will be $5,000. • if a salesperson sells $100,000 in revenue while working with a company that pays 8 percent of the revenuo, his/her commission check will be $8,000. The program should have a method named CalculateDisplayCommission that receives the revenue sale by a salesperson and the commission percentage as arguments, and calculates and displays the commission earned by the salesman. See examples below: Salesperson's Commis. |Salesperson's Commis. 100000 Revenue Sale: 100000 Revenue Sale: Commission Percentage: Commission…arrow_forwardHands-On Activity 4-4 BuzzButtons is a novelty item company manufacturing personalized lapel buttons that buzz randomly. The buttons are marketed as a conversation starter, and the company's slogan is "It starts the buzz!" The owner is promoting his buttons by offering them at 99 cents each. He wants you to design a program asking the user for his or her name for the button, an e-mail address, and the number of buttons to order. The program should then add a 6% sales tax and a flat shipping rate of $2.00. The program displays the information the user enters as well as the button price total, sales tax amount, shipping amount, and order total. The company contacts the user by e-mail later for shipping address information. Using pseudocode, design an algorithm that asks the user for the number of fixed-price items to order, adds sales tax and flat-rate ship- ping, and displays the result. Save your pseudocode file in Notepad as buzzButtons.txt.arrow_forwardC# Language should accept inputs that has decimal pointsarrow_forward
- 1. Complete an algorithm, code and compile the following program. Save the program as mathTutor.py. Math Tutor You will be creating a math tutor program that can be used for young children to practice their math skills. The program will be driven by the following menu: See Rules Practice Math Exit If the user chooses (1) from the menu, the following rules will be displayed: This program will help you practice your math skills. First, you will choose Addition, Subtraction or Multiplication. Next, you will choose a level. Level 1 will give you problems with single digits and Level 2 will use two-digit numbers. Then, you will choose how many math problems you would like to complete. After you have completed all your problems, you will be given a score. You can play as many times as you want. Have fun!! If the user chooses (2) from the menu: First, prompt from the following math operation menu: Addition Subtraction Multiplication Next, prompt from the following level menu:…arrow_forwardPython Programming Only Please: The colors red, blue, and yellow are known as the primary colors because they cannotbe made by mixing other colors. When you mix two primary colors, you get a secondarycolor, as shown here: When you mix red and blue, you get purple.When you mix red and yellow, you get orange.When you mix blue and yellow, you get green. Design a program that prompts the user to enter the names of two primary colors to mix. Ifthe user enters anything other than “red,” “blue,” or “yellow,” the program should displayan error message. Otherwise, the program should display the name of the secondary colorthat results.arrow_forwardLanguage: JAVAarrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning