Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need this in JavaScript ASAP plz. Thank you The program for this Assessment will consist of three sections, each headed by the three-line comment below:

Need this in JavaScript ASAP plz. Thank you

The program for this Assessment will consist of three sections, each headed by the three-line comment below:

//*********************************************************

//****Assessment 2 Program 4 Section X

//*********************************************************

(where X stands for the portion of the Assessment to follow.)

Assessment Requirements

Section 1:

Enter the comment with the section title as described above.

Create an arrayList named produceList.

ProduceList is used to hold the description and price of an item. Add the following data to the produce list:

bananas 0.59

grapes 2.99

apples 1.49

pears 1.39

lettuce 0.99

onions 0.79

potatoes 0.59

peaches 1.59

Write the data from produceList to a file called ProducePrice.

Write a function, named FileLineCount(), that returns an integer and accepts a string. Pass the function the file name. It shouldthen use a while loop to return the number of lines in a file. Hint: The function will be reading the file you just created above.

Call the function, FileLineCount(), and display its return value as the number of items in the file using the following format: "There are xx products in the file." Where xx is the number returned by FileLineCount().

Section 2:

Enter the comment with the section title as described above.

You will add four more items to the ProducePrice.txt file. They are as follows: peppers 0.99 celery 1.29 cabbage 0.79 tomatoes 1.19

Call the function, FileLineCount(), and display its return value as the number of items in the file using the following format: "There are xx products in the file." Where xx is the number returned by FileLineCount().

EXPECTED OUTPUT

There are 8 products in the file.

There are 12 products in the file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

What are the purposes of promotion ?

Answered: 1 week ago