SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 314 Weeks Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 28 Nov 2017 My Price 10.00

Read student names and grades from a file into an array.

Write a Bash script to do a binary search. Read student names and grades from a file into an array. Prompt the user for a student name. Find the name in the array and display the grade. If the student does not exist, print a message stating that.

 

The data in the file is below:

Ann:A

Bob:C

Cindy:B

Dean:F

Emily:A

Frank:C

Ginger:D

Hal:B

Ivy:A

Justin:F

Karen:D

 

Your Assignment is to write a bash script to do a binary search The details are in theassignment link here are a few hints to help you with this assignment.

To get data from the user, use the read statement like this. It will display the prompt and read the response into the variable answer.

read-p “please enter something” answer

To read data from a file named students.dat and store it into an array named students, you may use a while loop like this:

Count=0

while read students[$Count}

do

(Count ++))

done < student.dat

To separate an array element into name and grade use the following. The quote Marks you see are the grave accent character. It is just above the left tab key on the keyboard.

name= `echo ${students($loc)} | cut -d:f1`

grade= `echo ${students($loc)} |cut -d: f2`

Attachments:

Answers

(5)
Status NEW Posted 28 Nov 2017 12:11 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)