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 14:10
If the thermal strain developed in polyimide film during deposition is given as 0.0044. assume room temperature is kept at 17.3 c, and thermal coefficient of expansion for the film and the substrate are 54 x 10^-6c^-1 and 3.3 x 10^-6c^-1respectively. calculate the deposition temperature.
Answers: 3
question
Engineering, 04.07.2019 18:10
Atmospheric air has a temperature (dry bulb) of 80Β° f and a wet bulb temperature of 60Β° f when the barometric pressure is 14.696 psia. determine the specific humidity, grains/lb dry air. a. 11.4 c. 55.8 d. 22.5 b. 44.1
Answers: 1
question
Engineering, 04.07.2019 19:10
Asteel wire of 2 mm diameter is fixed between two points located 2 m apart. the tensile force in the wire is 250n, if its density of steel is given by 7830 kg/m3 the fundamental frequency of vibration hz? ?
Answers: 3
question
Engineering, 04.07.2019 19:20
Heat transfer by is the fastest mode of heat transfer that requires no intervening medium. a)-conduction b)-convection c)-radiation d)-conduction and convection
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, 15.11.2019 07:31
Questions on the website: 13722361