Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 3, Problem 14PE
Program Plan Intro

Finding average

Program Plan:

  • Define the main function.
    • Get the value of “n” from the user.
    • Declare required variables.
    • Loop from 1 through “n+1”.
      • Get the numbers from the user and store it in a variable “num”.
      • Calculate the value of sum by adding “sum” and “num” and store it in a variable “sum”.
    • Find the average by using the formula “sum / n”.
    • Print the value of “average”.

Blurred answer
Students have asked these similar questions
f. A laborant in a laboratory does a number of antigen tests in one day. Write a program that simulates the number of antigen tests done in a day in a laboratory, displays the number of positives and negatives, and calculates the % of positives in one day. Your program needs to first generate a random number that will show the number of tests done in a day. One laboratory in a day cannot do more than 100 tests and less than 1 (they do at least one). Then for each of the tests, your program needs to generate a random number to show whether they are positive or negative. In order to write this program, you need to have the following three functions used by the main function: test result (void): This function generates a test result. It should randomly return either one or zero. 1 means positive test result and 0 means negative test result. float positive percentage (int,int) : This function takes the total number of positives and the total number of tests and returns the % of positives.…
Write a program that asks the user for the number of adult and the number of child movie tickets they are purchasing. (Store these values in variables using meaningful names.)  Print the percentage of adult tickets followed by a space and the percentage of child tickets.  Example: Suppose they are purchasing are 8 adult tickets and 12 child tickets. There are 20 total tickets being purchased. The percentage of adult tickets can be calculated as 100*(8 / 20). For example: Input Result 8 12 40.0 60.0
The body mass index, BMI, is a measure used to determine if a person is overweight or not. We can calculate BMI from the weight of the person (in pounds) and the height (in inches) of the person.The formula for calculating BMI is:BMI = (weightInPounds * 703) divided by (heightInInches squared)In this problem, you will develop a Java program as a BMI calculator, that reads the user’s weight in pounds and height in inches, then calculates and displays the user’s body mass index BMI. Also, display the following information {from the US Department of Health} so the user can evaluate his/her BMI:BMI values:Underweight: less than 18.5Normal: between 18.5 and 24.9Overweight: between 25 and 29.9Obese: 30 or greater
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Constants, Variables, Data types, Keywords in C Programming Language Tutorial; Author: LearningLad;https://www.youtube.com/watch?v=d7tdL-ZEWdE;License: Standard YouTube License, CC-BY