Problem on java programming

Assignment Help Programming Languages
Reference no: EM13322205

import java.util.*;
import java.io.*;

public class MainMethodClassName
{
public static void main(String args[])
{

Scanner readFile = null;

try

{

readFile = new Scanner(
new FileInputStream("numbers.txt"));
}


catch(FileNotFoundException e)
{

System.out.println("Sorry, this file could not be found.");
}

int max = readFile.nextInt();
int min = max;
while(readFile.hasNextInt());
{
int next = readFile.nextInt();
if(min > next)
min = next;

if(max < next)
max = next;
}

System.out.println("Maximum number:" + max);
System.out.println("Minimum number:" + min);
}
}

I have a text file located in the same folder with some various numbers, and it won't work. Thanks in advance.

Reference no: EM13322205

Questions Cloud

Calculate the frequency of the tone perceived by observer : A speaker generating a tone at 285 Hz is moving towards a stationary observer with a speed of 35 m/s
Compute the steady-stare creep rate and stress level : If it is known that the value of the stress exponent, n, for this alloy is 8, compute the steady-stare creep rate at 1300 K and a stress level of 90 MPa.
Write a method named maxelement : Write a method named maxElement, which returns the largest value in an array that is passed as an argument. The method should use recursion to find the largest element. Demonstrate the method in a program.
What is the first harmonic frequency of this pipe : An organ pipe is 1.42 m long. What is the first harmonic frequency of this pipe when it is open at both ends
Problem on java programming : I have a text file located in the same folder with some various numbers, and it won't work. Thanks in advance.
Determine the strength of the a992 steel column : A W18x130 section is used as a column with one end pinned and the other end is fixed against rotation but free to translate. The length is 12 ft. determine the strength of the A992 steel column.
How far is she from the cliff : A hiker is approaching a sheer cliff wall. She yodels, and hears the echo of her yodel after 3.3 s. How far is she from the cliff
Explain how does the epoxy coating protect reinforcement : Compare the effectiveness of the zinc coating with a typical epoxy coating on reinforcement. How does the epoxy coating protect reinforcement and what happens if the coating is nicked.
What are specifications need to be specified for waterways : what are the specifications need to be specified while creating a design for waterways. what are their uses. how are they maintained.

Reviews

Write a Review

Programming Languages Questions & Answers

  Which protocol is using by video game programmers udp or tcp

What protocol do you think video game programmers would use UDP or TCP. Why do you think the game uses one or the other protocols

  Design program that asks user to enter budgeted amount

"Design a program that asks the user to enter the amount that he or she has budgeted for a month. (For example: $2,000.00)

  Create application to enter number of units sold

Quantity discounts are given according: create an application that allows the user to enter the number of units sold for each software package.

  Program to read employee information in the array of objects

Let the program which will read employee information into the array of objects, sort array by employee identification number, write the sorted array.

  Users selection and return to menu

Create a menu that will allow the user to list all wines by name in alphabetic order and count all wines in each type and list all 5 types with their count

  Write program using to take input two integers by while loop

Write a program which uses while loops to perform following steps: Prompts user to input two integers: firstNum and secondNum. (firstNum must be less than secondNum).

  Prepare cron file to performs level dump every day

Prepare a cron file which will regularly perform the following backups: performs level 5 dump every day which neither a level 0 nor level 2 dump is performed.

  Program which calculate and displays fifteen percent tip

Write a program which calculate and displays a 15 percent tip when the price of a meal is input by the user. (Hint: the tip is computed by multiplying the price of the meal by 0.15.).

  Write program to find smallest-largest value from n numbers

Write down program which will determine the smallest, largest and average values in collection of N numbers. Get value of N before scanning each value in collection of N numbers.

  Create program-ask user to enter amount of purchase

Create a program which will ask the user to enter the amount of a purchase. The program must then compute the state and county sales tax.

  Construct a diagram using rationaleto map the arguments

Construct a diagram using Rationaleto map the arguments about a moral claim that you have identified in the article/case study

  Creating method to union the interface for adt bag

Add method union to  interface BagInterface for ADT bag which returns as new bag the union of bag receiving call to method and bag which is the method's one argument.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd