1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
goldenfox [79]
3 years ago
10

Write a static method named lowestPrice that accepts as its parameter a Scanner for an input file. The data in the Scanner repre

sents changes in the value of a stock over time. Your method should compute the lowest price of that stock during the reporting period. This value should be both printed and returned as described below.
Computers and Technology
1 answer:
NikAS [45]3 years ago
6 0

Answer:

Explanation:

The following code is written in Java. It creates the method as requested which takes in a parameter of type Scanner and opens the passed file, reads all the elements, and prints the lowest-priced element in the file. A test case was done and the output can be seen in the attached picture below.

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

class Brainly{

   public static void main(String[] args) throws FileNotFoundException {

       Scanner console = new Scanner(System.in);

       System.out.print("file location: ");

       String inputLocation = console.next();

       File inputFile = new File(inputLocation);

       Scanner in = new Scanner(inputFile);

       lowestPrice(in);

   }

   public static void lowestPrice(Scanner in) {

       double smallest = in.nextDouble();

       while(in.hasNextDouble()){

           double number = in.nextDouble();

           if (number < smallest) {

               smallest = number;

           }

       }

       System.out.println(smallest);

       in.close();

   }

}

You might be interested in
Create java program for these 2 question
morpeh [17]

1 see what you can do and go from their

7 0
3 years ago
Lesson 3: Wrapping Up Unit 6
GrogVix [38]

Answer:

A visual representation of colors arranged according to their hues, or the chromatic relation they share

Explanation:

7 0
3 years ago
Read 2 more answers
15. The legal right to control the
Iteru [2.4K]
The correct answer copyright
4 0
3 years ago
Read 2 more answers
Please help!!
kolbaska11 [484]

Answer:

HTML is the standard markup language for creating and designing websites

while

HTML5 is the fifth and the latest version of HTML

with new added features,tags and element

6 0
3 years ago
Look at the code, and then answer the question below. .links { text-align: center; font-size: 16px; font-color: blue; background
Dvinal [7]
Link text is blue and 16 pixels
8 0
3 years ago
Read 2 more answers
Other questions:
  • "Which of the following will help protect against a brute force attack?
    11·1 answer
  • A difference between crt monitors and flat-panel displays is that most flat-panel displays use digital signals to display images
    8·1 answer
  • You need to transmit PII via email and you want to maintain its confidentiality. Which of the following choices is the BEST solu
    8·1 answer
  • Which principle suggests that specific single responsibility interfaces are better than one general purpose interface?
    13·1 answer
  • What phobia is a fear of computers or working on a computer?
    6·1 answer
  • 4.In order for a driver to graduate from a learner’s license to an operator’s license, how many hours of driving need to be docu
    11·1 answer
  • Explain briefly what would happen if marketing research is not conducted before a product is developed and produced for sale.
    14·1 answer
  • Meats ages hair and feathers all contain this monomer
    13·1 answer
  • A print server uses a print ________ as a software holding area for jobs waiting to be printed.
    5·2 answers
  • Game Design!
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!