
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:Q5.2
Suppose that the file input.txt contained the following:
123
456
789
987
654
321
What would be printed by executing the following command?
$ java E2b < input.txt I java E2b
Also, explain what this command does.
Enter your answer here
![Q5.1 Write a program E2b
Write a Java program called E2b that will read from Stdln an integer, n, and will set the size of a
2D array to have n rows and n columns. The values in this n xn 2D array must be read from
Stdln and the array must be filled in row-major order.
For example, if the following input stream was read: 4 1234 4321 9876 5764
The 2D array created would be:
2
4
3
2
1
9.
8
7
6
4
Include in the program above, code that would print the values in the 2D array beginning with
the value in the last row, last column and ending with the value in the Oth row, Oth column,
traversing the columns from bottom to top, printing n values in each row of the output. The
values In the array do not change. You are simply printing them in a unique order.
For example, for the array given above, the output would be:
4
6
1
4
6
7
8
3
2
4
1
public class E2b
public static void main(String[] args)
// WRITE YOUR CODE HERE
Enter your answer here](https://content.bartleby.com/qna-images/question/9e6a21cc-3cec-479a-80f5-ec5284fd993c/1388a620-c291-4b18-bc48-01aa36cc7db0/4ycf3ib_thumbnail.jpeg)
Transcribed Image Text:Q5.1 Write a program E2b
Write a Java program called E2b that will read from Stdln an integer, n, and will set the size of a
2D array to have n rows and n columns. The values in this n xn 2D array must be read from
Stdln and the array must be filled in row-major order.
For example, if the following input stream was read: 4 1234 4321 9876 5764
The 2D array created would be:
2
4
3
2
1
9.
8
7
6
4
Include in the program above, code that would print the values in the 2D array beginning with
the value in the last row, last column and ending with the value in the Oth row, Oth column,
traversing the columns from bottom to top, printing n values in each row of the output. The
values In the array do not change. You are simply printing them in a unique order.
For example, for the array given above, the output would be:
4
6
1
4
6
7
8
3
2
4
1
public class E2b
public static void main(String[] args)
// WRITE YOUR CODE HERE
Enter your answer here
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps

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
- Write a program that reads integers user_num and div_num as input, and output the quotient (user_num divided by div_num). Use a try block to perform all the statements. Use an except block to catch any ZeroDivisionError as a variable and output "Zero Division Exception: " followed by the exception message from the variable. Use another except block to catch any ValueError caused by invalid input as a variable and output "Input Exception: " followed by the exception message from the variable. Note: ZeroDivisionError is raised when a division by zero happens. ValueError is raised when a user enters a value of different data type than what is defined in the program. Do not include code to raise any exception in the program. (in Python)arrow_forwardI would like to open a data file in Java for Exercise 6 in Chapter 4 of JAVA by Gaddis & Muganda. The file properties shows in Explorer the location as C: \Users\Vladi\Desktop. The Files is Exercise0406.txt. I inserted the lineFile file = new File(“C:\Users\Vladi\Desktop\Exercise0406.txt”);I get Exception cannot find file.arrow_forwardImagine you are developing software for De Anza College that requires uses to enter their password. Software requires that the password be encrypted using the following criteria:1. All letters are converted to a number of your choice.2. All numbers are converted to an alphabet3. All punctuation characters are converted to 0.Write a class that takes a password input and meets the state criteria. Demonstrate the program that allows the user to enter a password and then display the encrypted message for testing purposes.arrow_forward
- Java Proram ASAP There is an extra /n in the program in test case 1-3 and after Please re-enter the file name or type QUIT to exit:\n quitENTER in test case 4 there needs to be nothing as shown in the screenshot. The text files are located in Hypergrade. Please modify this code below so it passes the test cases. Also I have the correct test case as a screenshot. import java.io.*;import java.util.Scanner;public class ConvertText { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); System.out.println("Please enter the file name or type QUIT to exit:"); while (true) { String input = sc.next(); if (input.compareTo("QUIT") == 0) { break; } else { String filePath = new File("").getAbsolutePath(); filePath = filePath.concat("/"); filePath = filePath.concat(input); File file = new File(filePath); if…arrow_forwardsolve:arrow_forwardPlease answer properly with output screenshot must Where is the error in this code? from telethon.sync import TelegramClientfrom telethon.tl.functions.messages import GetDialogsRequestfrom telethon.tl.types import InputPeerEmptyimport os, sysimport configparserimport csvimport time re="\033[1;31m"gr="\033[1;32m"cy="\033[1;36m" def banner():os.system('clear')print("ok") cpass = configparser.RawConfigParser()cpass.read('config.data') try: api_id = cpass['cred']['id'] api_hash = cpass['cred']['hash'] phone = cpass['cred']['phone'] client = TelegramClient(phone, api_id, api_hash)except KeyError: os.system('clear') banner() print(re+"[!] run python3 setup.py first !!\n") sys.exit(1) client.connect()if not client.is_user_authorized(): client.send_code_request(phone) os.system('clear') banner() client.sign_in(phone, input(gr+'[+] Enter the code: '+re))os.system('clear')banner()chats = []last_date = Nonechunk_size = 200groups=[]result =…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