Question

Design a program that inputs a list of up to 50 real values from a data...

Design a program that inputs a list of up to 50 real values from a data file, Problem1InputFile.txt, and print the count and smallest value to the screen.

Hint: an array is not really needed, but you can use one.

Here is one sample input file for Problem1InputFile.txt (note that there is one real value per line and there is an extra blank line at the end):

10.5

2.1

2.0

-1.7

-0.5

Sample output:

Count:       5

Smallest: -1.7

  1. Give pseudocode for the problem & store it in a file (Problem1Pseudocode.docx).

  1. Write a Java program (Problem1Program.java) using the pseudocode in (a).
  1. Create your testing-input-file (Problem1InputFile.txt) for testing your program.

Just pseudocode please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the required pseudocode:

Declare number as real
Declare total as real
Declare
smallest as real

Set total = 0

Open file Problem1InputFile.txt to read
number = read next number
Set smallest = number

while there is a real number
   number = read next number
   if number < smallest
       smallest = number
   end if
   total = total + number
end while

Display total
Display smallest

This completes the requirement. Let me know if you have any queries.

Thanks!

Add a comment
Know the answer?
Add Answer to:
Design a program that inputs a list of up to 50 real values from a data...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that inputs up to 100 real numbers from the keyboard (one at a...

    Write a program that inputs up to 100 real numbers from the keyboard (one at a time). When a number greater than 1.0e9 is input the keyboard input will stop. Then the following statistic for the input data will be computed and printed out to the screen. a) average b) standard deviation c) minimum value d) maximum value e) range = (maximum-minimum)/2 f) the number of times zero is input **Note: this is a program in C++** 3) Write a...

  • Write a Java program that inputs a list of integer values in the range of −...

    Write a Java program that inputs a list of integer values in the range of − 1 to 100 from the keyboard and computes the sum of the squares of the input values. This program must use exception handling to ensure that the input values are in range and are legal integers, to handle the error of the sum of the squares becoming larger than a standard Integer variable can store, and to detect end-of-file and use it to cause...

  • What to submit: your answers to exercises 2. Write a Java program to perform the following...

    What to submit: your answers to exercises 2. Write a Java program to perform the following tasks: The program should ask the user for the name of an input file and the name of an output file. It should then open the input file as a text file (if the input file does not exist it should throw an exception) and read the contents line by line. It should also open the output file as a text file and write...

  • Write a program that scores the total rainfall for each of 12 months into an array...

    Write a program that scores the total rainfall for each of 12 months into an array double. A sample array definition is shown below double thisYear[] = {1.6, 2.1, 1.7, 3.5, 2.6, 3.7, 3.9, 2.6, 2.9, 4.3, 2.4, 3.7}; The program should have the four functions to calculate the following 1. The total rainfall for the year 2. The average monthly rainfall 3. The month with most rain 4. The month with least rain Output: What to deliver? Your .cpp...

  • Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design...

    Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design and code a Java console application that reads in seven integer values and prints out the number of occurrences of each value. The application uses the Java single dimension array construct to implement its functionality. Your program output should look like the sample output provided in the "Count Occurrences in Seven Integers Using Java Single Dimension Arrays Instructions" course file resource. Full instructions for...

  • write a complete Java program with comments in main and in each method. Data: The input data for this program is given as two columns of numbers. All data will be entered from a fle named input.t...

    write a complete Java program with comments in main and in each method. Data: The input data for this program is given as two columns of numbers. All data will be entered from a fle named input.txt and all output will go to the screen Assume there will not be more than 100 7 23.56 16 88.12 10 75.1 Design a Java class with a main method that does the following 1) Reads the data into two arrays of doubles,...

  • Java Program Create a class to store an array of with enough space to store 10 integer values. Us...

    Java Program Create a class to store an array of with enough space to store 10 integer values. Using the principle of recursion, implement the following: *getSize : returns the size of the array. *get (i): returns the i-th element of the array. If the element does not exist, it throws a "NoSuchElementException” which is a subclass of Java class RunTimeException. *add (val): inserts value as the last element of the array. If necessary, double the size of the current...

  • For C++ Write a main program that inputs a list of 20 numbers from a text file and then calls 4 ...

    For C++ Write a main program that inputs a list of 20 numbers from a text file and then calls 4 sort functions. Create a Sort Lab design document that include flowcharts of the main program and four sort functions Sort Functions:   Insertion, Selection, Bubble and Merge In each Sort function: count the number of compares and swaps needed to sort the numbers and display that information in the sort function. Run the program for four sets of data --...

  • You will develop a program that will read a list of integers into an array. Data...

    You will develop a program that will read a list of integers into an array. Data entry will end when a negative number is entered. When data entry is completed, the program will ask for a nominal value. When this number is entered, two lists will be displayed-one containing the numbers equal to or above the nominal value and a second one with the values below the nominal. A typical output is shown below: This program inputs a list of...

  • Write a Java program called Histogram.java that displays a list of distinct characters in an input...

    Write a Java program called Histogram.java that displays a list of distinct characters in an input tile and the occurrence of each eharacte. Your iogram should 1ead an input file name from a use. After that, your program should read characters in the file and display a list of distinct characters and their occurTeces. Finally, your program should draw a veril bafo the occuences For the assignment, your program has.to display the result exactly as the sample run. For instance,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT