Concept explainers
Using Files—Total and Average Rainfall
Write a
During the months of March–June, the total rainfall was 7.32 inches and the average monthly rainfall was 1.83 inches.
Data for the program can be found in the Rainfall. txt file located in the Chapter 5 programs folder on the book’s companion website.
Hint: After reading in the month names, you will need to read in rain amounts until the EOF is reached and count how many pieces of rain data you read in.
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Problem Solving with C++ (10th Edition)
Starting Out With Visual Basic (7th Edition)
Database Concepts (7th Edition)
Problem Solving with C++ (9th Edition)
Starting Out with Python (3rd Edition)
- In python The text file “studentMarks.txt” has been provided for you. Each line contains the Last Name, First Name and 8 marks separated by spaces of a single student. For each student in the file, adjust the file to include the average of their top 6 marks, rounded to 1 decimal place, at the end of the line. For example, in the file, the line may say: Mars, Bruno 82 82 85 94 65 79 81 90 Afterwards, it should be updated to say: Mars, Bruno 82 82 85 94 65 79 81 90 Top6Avg: 85.7 Your program must define a function to determine the average of the top 6 marks. You may define more functions as needed for your program.arrow_forwardIt is a complete question.arrow_forwardBy use python languagearrow_forward
- Use Pycharmarrow_forwardusing python Filename for submission: bottles.py In many jurisdictions a small deposit is added to drink containers to encourage people to recycle them. In one particular jurisdiction, drink containers holding one liter or less have a $0.10 deposit, and drink containers holding more than one liter have a $0.25 deposit.Write a program that reads the number of containers of each size from the user. Your program should continue by computing and displaying the refund that will be received for returning those containers. Format the output so that it includes a dollar sign and two digits to the right of the decimal point. Don’t forget: Include a flowchart that describes your program’s operation (this will be counted as part of your grade as ‘documentation’ in the grading rubric) Sample outputarrow_forwardWrite a program that takes the birth year from the user and prints her/his age. Here are sample runs of the program: Sample 1: Enter your birth Your Age is: 42 years Sample 2: year: 1981 Enter your birth year: 2000 Your Age is: 23 years 3arrow_forward
- Javaarrow_forwardThe pressure of a gas changes as the volume and temperature of the gas vary. Write a program that uses theVan der Waals equation of state for gas, to create a file that displays in tabular form the relationship between the pressure and the volume of n molesof carbon dioxide at a constant absolute temperature (T). P is the pressure in atmospheres, and V is thevolume in liters. The Van der Waals constants for carbon dioxide are a = 3.592 L2 · atm/mol2 and b = 0.0427L/mol. Use 0.08206 L · atm/mol · K for the gas constant R. Inputs to the program include n, the Kelvintemperature, the initial and final volumes in milliliters, and the volume increment between lines of the table.Your program will output a table that varies the volume of the gas from the initial to the final volume insteps prescribed by the volume increment. Here is a sample run:arrow_forwardC++ A company hired 10 temporary workers who are paid hourly and you are given a data file that contains the last name of the employees, the number of hours each employee worked in a week, and the hourly pay rate of each employee. You are asked to write a program that computes each employ- ee’s weekly pay and the average salary of all the workers. The program then outputs the weekly pay of each employee, the average weekly pay, and the names of all the employees whose pay is greater than or equal to the average pay. If the number of hours worked in a week is more than 40, then the pay rate for the hours over 40 is 1.5 times the regular hourly rate. Use two parallel arrays: a one-dimensional array to store the names of all the employees, and a two-dimensional array of 10 rows and 3 columns to store the number of hours an employee worked in a week, the hourly pay rate, and the weekly pay. Your program must contain at least the follow- ing functions—a function to read the data from…arrow_forward
- Write a C++ program that prompts the user to enter a file name that contains the scores of students in a quiz. Each line in the input file contains a student name followed by the student’s score (as shown in the sample file to the right). The program should then find out the students with the minimum score and the maximum score and display their names and scores. Marks.txt Ahmed 90 Badria 85 Noor 91 Khalid 70 Said 65 Suha 80arrow_forwardI want solution with stepsarrow_forwardStatistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the average (using integer division) and max. A negative integer ends the input and is not included in the statistics. Ex: When the input is: 15 20 0 5 -1 the output is: 10 20 Assume that at least one non-negative integer is input.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning