Concept explainers
Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 10 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Additional Engineering Textbook Solutions
Artificial Intelligence: A Modern Approach
Web Development and Design Foundations with HTML5 (8th Edition)
Absolute Java (6th Edition)
Starting out with Visual C# (4th Edition)
Starting Out with Python (4th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
- Write a program that reads a file consisting of students' test scores in the range 0-200. It should then determine the number of students has scored in each of the following ranges:0-24, 25-49, 50-74, 75-99, 100-124, 125-149, 150-174, and 175-200. Output the score ranges and the number of students. (Run your program with the following input data: 76, 89,150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129,149, 176, 200, 87, 35, 157, 189.)arrow_forwardWrite a program that reads 5 integer numbers from a file"integer.txt",and store sum and average in "result.txt".arrow_forwardWrite a program that reads a file consisting of students’ test scores in the range 0–200. It should then determine the number of students having scores in each of the following ranges:0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200.Output the score ranges and the number of students. (Run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189 #include <iostream> #include <fstream> #include <string> using namespace std; int main() { int scores; int i [8] = { 0 }; ifstream infile("Ch8_Ex4Data.txt"); if ("Ch8_Ex4Data.txt") { while (infile >> scores) { if (scores >= 0 && scores <= 24) i[0]++; if (scores >= 25 && scores <= 49) i[1]++; if (scores >= 50 && scores <= 74) i[2]++; if (scores >= 75 && scores <= 99)…arrow_forward
- Write a program that reads a student's name followed by five test scores. The program should output the student's name, the five test scores, and the average test score. Output the average test score with two decimal places. The data to be read is stored in a file called test.txt. The output should be stored in a file called testavg.txt. test.txt: A file containing the student names and the five test scores for every student. Andrew Miller 87.50 89 65.75 37 98.50 Green Sheila 91.05 75.88 50.0 65.5 74.30 Sethi Amit 49.82 75 30 74 86.30 testavg.txt: A file containing the student name, the five test scores, and the average of the five test scores for each student.arrow_forwardWrite a program that reads every line in a text file, removes the first wordfrom each line, and then writes the resulting lines to a new text file.arrow_forwardWrite a program to compute Letter grades for a course. The course records are in a file that will serve as the input file. Each line of the file contains a student’s last name, then one space, quiz scores, All on one line. The program should ask the instructor about the grading scheme. Based on the input grades and the grading scheme, the system will print out for the instructor the final letter grades for all students. The instructors can choose an option to save all the grades in a text file.arrow_forward
- Write a program that reads in from a file a starting month name, anending month name, and then the monthly rainfall for each monthduring that period. As it does this, it should sum the rainfall amountsand then report the total rainfall and average rainfall for the period.For example, the output might look like this:During the months of March–June, the total rainfall was 7.32 inchesand the average monthly rainfall was 1.83 inches.arrow_forwardWrite a python program that asks the user how many words they would liketo write to a file, and then asks the user to enter that many words,one at a time. The words should be written to a file.arrow_forwardWrite a program that asks any number of students to enter their final grade and enables you to store these grades into a grades.txt plain text file. Then it reads the grades from the grades.txt file, and displays the individual grades and their count and average.arrow_forward
- Write a program that will read a message from another text file and surround each occurrence of an abbreviation with <> brackets.arrow_forwardWrite a program that reads the contents of a text file and prints the letter that starts the mostunique words in that file.arrow_forwardWrite a program, and store it in a file called Travel Expenses.xlsm, that does the following: (a) It asks for a person’s first name and stores it in firstName; (b) it asks for a person’s last name and stores it in lastName; (c) it asks for the number of miles the person traveled on a recent trip and stores it in nMiles; (d) it asks for the average miles per gallon the person got on the trip and stores it in milesPer- Gallon; (e) it asks for the average price per gallon paid for gas on the trip and stores it in avgPrice; (f) it calculates the cost of the trip and stores it in tripCost; and (g) it displays a message such as "Bob Jones traveled 800 miles, got 31.3 miles per gallon on average, paid $3.49 per gallon on average, and paid a total of $89.20 for gas." Make sure there is an Option Explicit line at the top of the module and that you declare all of your variables appropriately.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT