subject
Engineering, 14.03.2020 05:28 rowdycar313p0ao5k

Item list We have a list of products and their prices. Each line contains the name of the item and its price separated by a comma. Write a program that reads a txt file and computes the following:

The number of lines in the file

The most expensive product

The least expensive product

Edge cases:

If multiple items qualify as the most/least expensive product, then print only the first product.

The files have not been pre-processed. It might contain empty lines in the file.

If the file cannot be opened, then print "Could not open file."

Sample file(products. txt): Apple EarPods, 19.99

Bose QuietComfort 35, 292.42

Apple AirPods , 139.00

Beats Solo3, 189.98

Sample run1 (bold is user input)

Enter the file name:

products. txt

The number of lines: 4

The most expensive product: Bose QuietComfort 35

The least expensive product: Apple EarPods

Sample run 2 (bold is user input)

Enter a filename:

does-not-exist. txt

Could not open the file.

ansver
Answers: 3

Another question on Engineering

question
Engineering, 03.07.2019 15:10
Two flowing streams of argon gas are adiabatically mixed to form a single flow/stream. one stream is 1.5 kg/s at 400 kpa and 200 c while the second stream is 2kg/s at 500 kpa and 100 ? . it is stated that the exit state of the mixed single flow of argon gas is 150 c and 300 kpa. assuming there is no work output or input during the mixing process, does this process violate either the first or the second law or both? explain and state all your assumptions.
Answers: 1
question
Engineering, 04.07.2019 18:10
If a particle moves along a path such that r : (3 sin t) m and ? : 2t rad, where t is in seconds. what is the particle's acceleration in m/s in 4 seconds? a)- 16.43 b)- 16.29 c)- 15.21 d)- 13.79
Answers: 1
question
Engineering, 04.07.2019 18:10
Acompressor receives the shaft work to decrease the pressure of the fluid. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:10
Draw the engineering stress-strain curve for (a) bcc; (b) fcc metals and mark important points.
Answers: 1
You know the right answer?
Item list We have a list of products and their prices. Each line contains the name of the item and i...
Questions
question
Mathematics, 17.01.2020 14:31
question
Mathematics, 17.01.2020 14:31
question
Mathematics, 17.01.2020 14:31
question
Mathematics, 17.01.2020 14:31
Questions on the website: 13722367