
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
Question

Transcribed Image Text:need output, also the variables in the files
Scanner gamma;
FileWriter alpha, beta:
int x, y
alpha = new FileWriter("pohang", false);
beta
!!
= new FileWriter("busan.mp4", false);
for (x = 13; x< 18; x++) {
if (x % 2 == 1) {
System.out.printf("x");
) else (
System.out.printf("9%d\n", x):
alpha.write(String.format("%d\n", x + 5);
beta.write(String.format("%d 33 ", x + 7);
alpha.close():
beta.close();
alpha = new FileWriter("busan.mp4", false);
beta = new FileWriter("pohang", true):
for (x = 1; x < 4; x++) {
if (x 96 2 == 0)
beta.write(" ");
alpha.write(String.format("96d ", 44));
beta.write(String.format("96d", x*2));
alpha.close();
beta.close():
gamma = new Scanner(new File("pohang");
beta = new FileWriter("busan.mp4", true);
//pay attention
for (x = 3; x < 5; x++) {
y gamma.nextInt():
System.out.printf("%d", y);
beta.write(String.format("%d\n", x));
beta.write(String.format("x %d\n", x));
alpha.close();
beta.close():
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 4 steps with 3 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
- Using a Counter-Controlled whileLoop Summary In this lab, you use a counter-controlled while loop in a Java program provided for you. When completed, the program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. The data file contains the necessary variable declarations and some output statements. Instructions Ensure the file named Multiply.java is open. Write a counter-controlled while loop that uses the loop control variable to take on the values 0 through 10. Remember to initialize the loop control variable before the program enters the loop. In the body of the loop, multiply the value of the loop control variable by 2 and by 10. Remember to change the value of the loop control variable in the body of the loop. Execute the program by clicking Run. Record the output of this program.arrow_forwardUSING C++ PLEASE CREATE THREE FILES! IntCollection.h (or IntCollection.hpp): class definition IntCollection.cpp: class implementation main.cpp, including sample output and your answer to question 6 at the bottom. : main program to run the code The following code creates an IntCollection object named ‘c’. It adds seven integers to ‘c’, then uses a for loop to display the seven integers: int main() { IntCollection c; c.add(45); c.add(-210); c.add(77); c.add(2); c.add(-21); c.add(42); c.add(7); for (int i = 0; i < c.getSize(); i++) { cout << c.get(i) << endl; } } For this assignment you will add a copy constructor, a destructor, and three overloaded operators to the IntCollection class. In the design diagram below, the black member functions represent code that has already been implemented. You will be implementing the green items. Each item that you will be adding to the class is described below the diagram. private: int size // the number of ints currently stored in…arrow_forwardIf fopen cannot open the file (filename mistyped, file does not exist in the current directory (folder), or we have no permission to open the file, etc) then a.We know that there is a problem because the next fprintf fails b.fopen issues a standard matlab error explaining the problem c.The file will always be created if it does not exist and fopen always opens a file. It is the responsibility of the programmer to make sure that the file is indeed what he intended d. fopen returns -1 and we know there is a problem and fix itarrow_forward
- What does the following program open "source.txt" to do? #include int main () { FILE *fp; } = fp return 0; fopen("source.txt", "r"); For reading For reading and writing For creating a new file "source.txt" for reading For creating a new file "source.txt" for writingarrow_forwardpublic static void connectToInputFile() {Scanner inputStream = null;String inputFileName = getFileName("Enter name of input file: ");try{inputStream = new Scanner(new File("SortedA.txt"));}catch(FileNotFoundException e){System.out.println("File " + inputFileName + " not found. ");}catch(IOException e){System.out.println("Error opening input file: " + inputFileName);}}private static String getFileName(String prompt){String fileName = null;System.out.println(prompt);Scanner keyboard = new Scanner (System.in);fileName = keyboard.next();return fileName;}public static void connectToOutputFile(){String outputFileName = getFileName("Enter name of output file: ");try{outputStream = new ObjectOutputStream(new FileOutputStream("SortedArray.csv"));}catch(IOException e){System.out.println("Error opening output file" + outputFileName);System.out.println(e.getMessage());}}public static void closeFiles(){try{inputStream.close();outputStream.close();}catch(IOException e){System.out.println("Error…arrow_forwardModify this program so that it writes the values in two columns, like this: 32.00 54.00 67.50 29.00 35.00 80.00 115.00 44.50 100.00 65.00 Total: 622.00 Complete the following file: total.cpp 1 #include #include 3 #include #include 5 using namespace std; 4 7 int main() 8 { // Prompt for the input and output file names cout » input_file; cout > output_file; 10 11 12 13 14 // Construct the streams for reading and writing ifstream in(input_file); ofstream out(output_file); 15 16 17 18 // Check for errors and format the output stream if (in.fail() || out.fail(O) { return - 1; } out > value) { out <« setw(15) <« value <« endl; total = total + value; } 26 27 28 29 30 31 32 33 out << setw(8) << total « endl; 34 35 return 0; 36 }arrow_forward
- How can I have my program read a file from the console? the input in the command line for example is: java Test03 -i <filename> java Test03 -s <filename> The program will read the file and index it as in the previous option (-i), but will then prompt the user to enter a word, instructing the user that entering an empty line (no printable characters) will cause the program to exit. The program will then find the word in the tree, outputting the words (but not the indices) of each node it searches to demonstrate that it is performing a proper search and demonstrating that your binary search tree is properly structured. If it finds the target word, it will then output (on a separate line) the word's entry as specified in the previous option (-i). (Hint: a method to output a node's data into a String and then print that string using println().) The program will then prompt the user to enter a word (as before), continuing in the loop until the user exits the program.arrow_forwardHow do I print an output from a Code::Blocks file?arrow_forwardmy assignment wants me to : The provided file has syntax and/or logical errors. Determine the problem and fix the program. i have no luck in finding them. // Program asks user to enter password // If password is not "home", "lady" or "mouse" // the user must re-enter the password using static System.Console; class DebugFive1 { static void Main() { const string PASS1 = "home"; const string PASS2 = "lady"; const string PASS3 = "mouse"; string password; Write("Please enter your password "); password = Console.ReadLine(); while(password != PASS1 || password != PASS2 || password != PASS3) WriteLine("Invalid password. Please enter again. "); password = ReadLine(); WriteLine("Valid password"); } }arrow_forward
- This is phython not Java Lab: Write a file copying program. The program asks for the name of the file to copy from (source file) and the name of the file to copy to (destination file). The program opens the source file for reading and the destination file for writing. As the program reads each line from the source file and it writes the line to the destination file. When every line from the source file has been written to the destination file, it close both files and print “Copy is successful.” In the sample run, “add.py” is the source file and “add-copy.py” is the destination file. Note that both “add-copy.py” is identical to “add.py” because “add-copy.py” is a copy of “add.py”. Sample run: Enter file to copy from: add.py Enter file to copy to : add-copy.py Copy is successful. Source file: add.py print("This program adds two numbers") a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) print(f"{a} + {b} = {a+b}") Destination…arrow_forward9b_act2. Please help me answer this in python programming.arrow_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