Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need some help! this must be written in java Goal: (1) Template for future MAs (2) Deal with 1/O correctly (3) Know how to

i need some help! this must be written in java image text in transcribed
image text in transcribed
Goal: (1) Template for future MAs (2) Deal with 1/O correctly (3) Know how to submit MAs Problem: Write a program that prints the minimum of two selected numbers from a line. - First line of input contains the number of lines to follow - First number n of each line, 4n1000, contains the number of integers that follow in the line - Those n integers (each integer 0 and 1000 ) follow till the end of the line (separated by space), and should be stored (except the last two) in an array using indices 1,,n 2 - The last two integers x,y(1x,yn2) in the line are the indices (starting from 1) of the integers from the line to compare Input/output in Java: - Read input from a file input.txt and write to the console (make sure the input file is named input.txt, do not name it anything else!) - To read numbers, use a single File and Scanner object - File file = new File("input.txt"); - Scanner scan = new Scanner(file); - Use nextInt() over and over to read integers number = scan.nextInt () - To print output to console use standard System.out: - System.out.println (number); - Do not write anything extra except for the result. For example, do not write human centric messages like ("the result is..."). The output must be displayed line by line as shown in the example above. - Automated grading via script will be used for checking correctness of your output Submission through Canvas: - Only submit Java source file and name it MAT.java (T stands for trial. Make sure the name is in all caps as shown.) - For future MAs, replace the T with the assignment number ex: MA1, MA2, etc. - Remember: in Java, class name should match the file name and is case sensitive - Please do not create your own packages - Do not place the file into a folder or zip the file - Make sure the program compiles and that it works for general input (not just the examples provided above)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions