Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 4, Problem 43PS
Write a
ALGORITHM 4-1 Pseudocode for Project 43
1 Prompt the user to enter a number
2 Read number
3 Display number
4 Get a random number and scale to range 3...37
5 Display random number
6 Set product to number * random number
7 Display product
8 Display ceiling of random number
9 Display floor of product
10 Display number raised to power of random number
11 Display square root of random number
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Task 2: Using
Function-Temperature
Table
The formula for converting a temperature from Fahrenheit to Celsius is:
5
C = (F-32)
Where F is the Fahrenheit temperature and C is the Celsius temperature. Write a function
named Celsius that accepts a Fahrenheit temperature as an argument. The function should
return the temperature, converted to Celsius. Demonstrate the function by calling it in a loop
that displays a table of Fahrenheit temp. 0 through 20 and there Celsius equivalents.
The program should display the number of numbers found in the file, the sum of the
numbers, and the average of the numbers.
SalaryStmt.py
Write a python program that accepts name of an employee and
employee's yearly sales of last five years. The data should be
collected for n employees.
The value of n should also be accepted as input.
All amounts should be displayed with three decimal places.
The output should be displayed as a table containing the Employee
name, Average Sales and Bonus.
The program must define and use a function with Total Sales as a
parameter and should calculate the Average Sales and Bonus for
each employee. Bonus must be calculated based on the following
table:
Average Sales (AS)
AS<5000
5000ZAS<7500
7500ZAS<10000
AS210000
Bonus
1% of Average Sales
2% of Average Sales
4% of Average Sales
7% of Average Sales
Sample Output
Employee Name
Average Sales
Bonus
AFRAH
ASMA
ATHEER
НАЈAR
8577.000
6476.800
4943.000
343.080
129.536
49.430
718.200
315.064
135.608
352.888
365.072
305.240
303.216
10260.000
MALLAK
7876.600
6780.400
8822.200
9126.800
MARYAM
NOORA
SAHAR
SHEFAA
7631.000
TAGHARID
7580.400
SalaryStmt.py
Write a python program that accepts name of an employee and
employee's yearly sales of last five years. The data should be
collected for n employees.
The value of n should also be accepted as input.
All amounts should be displayed with three decimal places.
The output should be displayed as a table containing the Employee
name, Average Sales and Bonus.
The program must define and use a function with Total Sales as a
parameter and should calculate the Average Sales and Bonus for
cach employee. Bonus must be calculated based on the following
table:
Average Sales (AS)
AS<5000
50002AS<7500
75002AS<10000
AS210000
Bonus
| 1% of Average Sales
2% of Average Sales
4% of Average Sales
7% of Average Sales
Sample Output
====:
Employee Name
Average Sales
Bonus
===
AFRAH
8577.000
343.080
ASMA
6476.800
129.536
4943.000
10260.000
ATHEER
49.430
718.200
315.064
135.608
352.888
365.072
305.240
НАЈАR
HAJAR
7876.600
6780.400
8822.200
9126.800
7631.000
7580.400
MALLAK
MARYAM
NOORA
SAHAR
SHEFAA…
Chapter 4 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
Ch. 4 - Prob. 1PSCh. 4 - The function definition contains the code for a...Ch. 4 - Function calls that return void may not be used as...Ch. 4 - The address operator (&) is used to tell the...Ch. 4 - Variables defined within a block have global...Ch. 4 - Prob. 6PSCh. 4 - Which of the following statements about function...Ch. 4 - Which of the following is not a part of a function...Ch. 4 - Which of the following statements about function...Ch. 4 - Which of the following statements about local...
Ch. 4 - Prob. 11PSCh. 4 - Prob. 12PSCh. 4 - Which of the following statements will generate a...Ch. 4 - Which of the following statements about structure...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function...Ch. 4 - Find any errors in the following function calls:...Ch. 4 - Evaluate the value of the following expressions:...Ch. 4 - Evaluate the value of the following...Ch. 4 - Prob. 23PSCh. 4 - Define the range of the random numbers generated...Ch. 4 - What would be printed from Program 4-17 when run...Ch. 4 - Prob. 26PSCh. 4 - Prob. 27PSCh. 4 - Prob. 28PSCh. 4 - Prob. 29PSCh. 4 - Write a program that generates a random number...Ch. 4 - Prob. 31PSCh. 4 - Code and run Program 4-16, "Top—down Development...Ch. 4 - Prob. 33PSCh. 4 - Prob. 34PSCh. 4 - Expand the calculator program, Program 4-15, to...Ch. 4 - Prob. 36PSCh. 4 - Write a function that receives a positive...Ch. 4 - Prob. 38PSCh. 4 - Prob. 39PSCh. 4 - Prepare a payroll earnings statement for the sales...Ch. 4 - Write a program that, given a beginning balance in...Ch. 4 - The formula for converting centigrade temperatures...Ch. 4 - Write a program that uses standard functions. The...Ch. 4 - Write a C program that creates customers' bills...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- User defined Function: Void Function 3. Create a 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 data type only for all variables declared Example Program Output: MENU MENU MENU (A) - addition subtraction [M] - mulțiplication division (X) - exit addition subtraction mulțiplication division exit addition subtraction multiplication division exit (A) (M) [D) IXI [M) [D] IX) Enter your choice: a Enter your choice: s Enter your choice: ADDITION Enter first number: 10 Enter second number: 20 The sum is 30 SUBTRACȚION Enter first number: 101 MULTIPLICATION Enter first number: 13 Enter second number: 3 The product is 39 Enter second number: 90 The difference is 11 MENU MENU MENU (A) addition IS) (A) - addition addition subtraction [M) - multiplication ID) division IXI - exit (A) [M) [D] subtraction multiplication division IX) IN) (DI (X) - exit subtraction…arrow_forwardMust show it in Python: Please show step by step with comments. Please show it in simplest form. Input and Output must match with the Question Please go through the Question very carefully.arrow_forwardIn order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following: Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”). Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room. You could make these separate functions or part of a single function, depending on how you prefer to organize your code. #Sample function showing the goal of the game and move commands def show_instructions(): #print a main menu and the commands print("Dragon Text Adventure Game") print("Collect 6 items to win the game, or be eaten by the dragon.") print("Move commands: go South, go North, go East, go West") print("Add to Inventory: get 'item name'") #In this solution, the player’s status would be shown in a separate function. #You may organize your…arrow_forward
- In order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following: Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”). Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room. You could make these separate functions or part of a single function, depending on how you prefer to organize your code. Sample function showing the goal of the game and move commands def show_instructions(): #print a main menu and the commands print("Dragon Text Adventure Game") print("Collect 6 items to win the game, or be eaten by the dragon.") print("Move commands: go South, go North, go East, go West") print("Add to Inventory: get 'item name'") The blue image is an example of how the code should look. The map image is the map your code should…arrow_forwardIn order for a player to navigate your game, you will need to develop a function or functions using Python script. Your function or functions should do the following: Show the player the different commands they can enter (such as “go North”, “go West”, and “get [item Name]”). Show the player’s status by identifying the room they are currently in, showing a list of their inventory of items, and displaying the item in their current room. You could make these separate functions or part of a single function, depending on how you prefer to organize your code.arrow_forward110% Assignment 3- S4.pdf SalaryStmt.py Write a python program that accepts name of an employee and employee's yearly sales of last five years. The data should be collected for n employees. The value ofn should also be accepted as input. All amounts should be displayed with three decimal places. The output should be displayed as a table containing the Employee name, Average Sales and Bonus. The program must define and use a function with Total Sales as a parameter and should calculate the Average Sales and Bonus for each employee. Bonus must be calculated based on the following table: Average Sales (AS) ASAS<7500 75002AS<10000 AS210000arrow_forward
- python function!: a function called popular_color with one parameter, of type dict[str, str] of names and favorite colors. The return type is a str and it is the most commonly occuring color. If two colors are tied for popularity, the first color shown will be picked.arrow_forwardThis is Final Warning ⚠️ Don't post AI generated answer or plagiarised answer. If I see these things I'll give you multiple downvotes and will report immediately.arrow_forwardcomputer programmingarrow_forward
- Create a function named fnTuition that calculates the tuition for a student. This function accepts one parameter, the student ID, and it calls the fnStudentUnits function that you created in task 2. The tuition value for the student calculated according to the following pseudocode: if (student does not exist) or (student units = 0) tuition = 0 else if (student units >= 9) tuition = (full time cost) + (student units) * (per unit cost) else tuition = (part time cost) + (student units) * (per unit cost) Retrieve values of FullTimeCost, PartTimeCost, and PerUnitCost from table Tuition. If there is no student with the ID passed to the function, the function should return -1. Code two tests: 1) a student who has < 9 student units, and 2) for a student who has >= 9 student units. For each test, display StudentID and the result returned by the function. Also, run supportive SELECT query or queries that prove the results to be correct.arrow_forwardOld-fashioned photographs from the nineteenth century are not quite black and white and not quite color, but seem to have shades of gray, brown, and blue. This effect is known as sepia, as shown in the figures below. Original Sepia Original Image & Sepia Image Write and test a function named sepia that converts a color image to sepia. This function should first call grayscale to convert the color image to grayscale. A code segment for transforming the grayscale values to achieve a sepia effect follows.Note that the value for green does not change. (red, green, blue) = image.getPixel(x, y)if red < 63: red = int(red * 1.1) blue = int(blue * 0.9)elif red < 192: red = int(red * 1.15) blue = int(blue * 0.85)else: red = min(int(red * 1.08), 255) blue = int(blue * 0.93) 1.GUI Test Generate sepia image 2.Convert gif to png 3.Image Test Image has been converted to sepiaarrow_forwardPlease help me write the code using PYTHONarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Computer Programming for Beginners | Functions, Parameters & Arguments | Ep24; Author: Programming With Avelx;https://www.youtube.com/watch?v=VXlh-qJpfw0;License: Standard YouTube License, CC-BY