Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
- Write a program that reads data from a file containing integers that ends with -999.
- Output the numbers that are divisible by 7
- Output the numbers that are divisible by 11
- Output the numbers that are not divisible by 7 or 11
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 2 images
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
- Can you help me write a C++ Program that does the following: Create a program that reads a file containing a list of songs andprints the songs to the screen one at a time. After each song is printed,except for the last song, the program asks the user to press enter for more.After the last song, the program should say that this was the last song andquit. If there were no songs in the file to begin with, the program shouldsay that there are no songs to show and quit.The program should begin by asking the user for the name of the input file.Each song consists of a title, artist and year.In the file, each song is given on three consecutive lines.Create this program using the latest version of the class Song you created. The latest version of the class song I created is below: #include <iostream>#include <string>using namespace std;class Song {private: string Title; string Artist; int Year;public: Song() : Title("invalid"), Artist("invalid"), Year(-1) {} Song(const string…arrow_forwardQI: Write a program to calculate the average of four integer score, and find the grade for 7 students. The program should do the following: 1. Read the first, second name and the four score of the 7 student from the file (E:lexam.txt), 2. Calculate the average and find the grade of the average by using the if and if else. 3. Save the first, second name, average and the grade for each student in file (E:grade.txt). (10 columns for the first and second name. 4 columns, precision 2, for the average and grade)arrow_forwardWrite program that reads a list of names from a data file and displays the names to the console. The program should prompt the user to enter a filename. Create such a file and check your code. Solve with python. Example of code format: #Prompt the user for file name file_name = input("Enter file name : ") #Open file with open(file_name,"r") as file: #Read file content f = file.readline() #split the contents into numbers numbers = f.split(' ') test_list = [int(i) for i in numbers] res = 1 #Find the product for i in test_list: res*=i #Print result print("Product of numbers in the list :",res)arrow_forward
- Java Your program must read a file called personin.txt. Each line of the file will be a person's name, the time they arrived at the professor's office, and the amount of time they want to meet with the professor. These entries will be sorted by the time the person arrived. Your program must then print out a schedule for the day, printing each person's arrival, and printing when each person goes in to meet with the professor. You need to print the events in order of the time they happen. In other words, your output will be sorted by the arrival times and the times the person goes into the professor's office. In your output you need to print out a schedule. In the schedule, new students go to the end of the line. Whenever the professor is free, the professor will either meet with the first person in line, or meet with the first person in line if nobody is waiting. Assume no two people arrive at the same time. You should solve this problem using a stack and a queue. You can only…arrow_forwardSuppose you are given a text file that contains the names of people. Every name in the file consists of a first name and last name. Unfortunately, the programmer that created the file of names did not guarantee that each name was on a single line of the file. Read this file of names and write them to a new text file sorted according to first name, one name per line. For example, if the input file contains Ed Marston Bob Jones Jeff Williams Fred Charles The output file should be Bob Jones Ed Marston Fred Charles Jeff Williams Use arrays to solve the problem.arrow_forwardWrite a program that reads the data of numbers shown below, does some math, then displays the output below on the screen. And then edit the program to also write the results of the first program to a different file. (Note: not to input the data of numbers you used in the first program, because that would replace your data.) You must write a program using the specified code below. Write a code using the following : def main(): # Add code that reads the numbers, # Calculate the total number of pets., # the average #, the minimum #, the maximum # # displays those numbers as specified in the instructions. main() The required output of the first program: The total Number of families: The total number of kids: The average number of kids per family: The maximum number of kids in a family: The minimum number of kids in a family: Data of numbers: 6319220021214151arrow_forward
- Write a program using a for loop that creates a file and adds odd numbers that are in the integers 1 through 20 to the file. Name the file as numbers.txt. Then perform the following on the file: Read all of the numbers stored in the file and calculate their total. Display all the numbers in the file and the calculated total Using a for loop add the following numbers to the file 21 through 30 Delete the following numbers from the file 24, 25, 26 (using a temp.txt file) Change the number 11 to 50 (using a temp.txt file)arrow_forwardIn pythonarrow_forwardWrite a program that asks the user for a file name and a string to search for. The program should search the file for every occurrence of a specified string. When the string is found, the line that contains it should be displayed. After all the occurrences have been located, the program should report the number of times the string appeared in the file.arrow_forward
- 9b_act2. Please help me answer this in python programming.arrow_forwardWrite a Python program for a simple quiz game. The questions and answers are stored in a text file named "questions.txt." Each line in the file represents a question and its corresponding options and correct answer in the format: "Question, Option1, Option2, Option3, Option4, CorrectOption." The program should load the questions from the file, present them to the user one by one, and keep track of their score. Allow the user to input their answer, and after completing the quiz, display their final score. Make sure to handle cases where "questions.txt" does not exist or has incorrect formatting. Use functions to structure your code, making it easier to understand and maintain. You can use a list or dictionary to store the questions and options. Ex: questions.txt: What is the capital of France?, Berlin, London, Paris, Madrid, 3 Who is the author of "To Kill a Mockingbird"?, Mark Twain, Harper Lee, J.K. Rowling, Ernest Hemingway, 2 What is the largest mammal on Earth?, Elephant, Blue…arrow_forwardI see you guys are providing many solutions for this program but it is not giving the output I am being asked for. 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 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, 189arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education