Question Details

(solution) Data Entry Write a simple data entry program. The data you are to


Data Entry
Write a simple data entry program. The data you are to enter is student data, including the student's name, the student's age, and the student's GPA.

Your script should prompt for this information for each student, as shown in the sample run below:

Enter student data? y
Name: John Jones
Age: 20
GPA: 3.2

In the above sample run, the underlined text is what the user typed in. The rest is what your program should output. Your program should continue reading in student data until the answer to the Enter student data? question is 'n' (for no). Then, your program should ask for a filename and print all student data to that file.

When printing, print the name left justified in a 25-character field, print the age right-justified in a 3-character field, and print the GPA right justified in a 4-character field. All columns should align in the file. For help with this printing, see the secton on printf at the end of this section.

Here is a sample run:


$ perl lab5a.pl

Enter student data? y

Name: J Jones

Age: 21

GPA: 3.2

Enter student data? y

Name: B Smith

Age: 18

GPA: 2.8

Enter student data? y

Name: Y Brown

Age: 20

GPA: 2.3

Enter student data? n

Enter file name: data

$cat data

J Jones 21 3.2

B Smith 18 2.8

Y Brown 20 2.3

You must include 6 subs, one to do each of the following:

Prompt for and read in the answer to the Enter student data? question.

Prompt for and read in the student's name.

Prompt for and read in the student's age.

Prompt for and read in the student's GPA.

Prompt for and read in the file name.

Print to the file at the end of the main program.

I suggest that you declare three arrays, one each to store the student's name, the student's age, and the GPA. Element 0 of these three arrays constitutes the data for one student. Element 1 is the data for another student ? and so on.

The approach of using several arrays, and using the same element of each for one bigger thing (e.g., a student) is called parallel arrays.

Remember, you can grow an array as the data is read by using the push function.

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Jan 30, 2021

PRICE: $15

Solution~0001017164.zip (25.37 KB)

Buy this answer for only: $15

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free solution (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Jan 30, 2021

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE.

Order Now