Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please help me!!!!! Write a Perl program to accomplish each of the following on

ID: 3677892 • Letter: P

Question

please help me!!!!!

Write a Perl program to accomplish each of the following on the file solar.txt (see link at the class homepage) 1. Print all records that do not list a discoverer in the eighth field. 2. Print every record after erasing the second field. Note: It would be better to say "print every record" omitting the second field. 3. Print the records for satellites that have negative orbital periods. (A negative orbital period simply means that the satellite orbits in a counterclockwise direction.) 4. Print the data for the objects discovered by the Voyager2 space probe. 5. Print each record with the orbital period given in seconds rather than days.

About solar.txt file: This file contains lines of 9 items, the first being:
Adrastea XV Jupiter 129000 0.30 0.00 0.00 Jewitt 1979 in alphabetical order by the name of the planet or moon (first field). The text in [] is the corresponding field from the line above. The fields in this file are: 1. Name of planet or moon [Adrastea] 2. Number of moon or planet (roman numerals) [XV] 3. Name of the abject around which the satellite orbits [Jupiter] 4. Orbital radius (semimajor axis) in kilometers [129000] 5. Orbital period in days [0.30] 6. Orbital inclination in degrees [0.00] 7. Orbital eccentricity [0.00] 8. Discoverer [Jewitt] 9. Year of discovery [1979]
Part 2: Separate, count and sort the words in the example text file, electricity.txt (see link at the class homepage). Sort in the following orders and your output should be nicely lined up in columns to the output file. 1. alphabetically (ignoring capitalization), 2. alphabetically with upper case words just in front of lower case words with the same initial characters 3. by frequency, from high to low, (any order for equal frequency) 4. by frequency, with alphabetical order for words with the same frequency
Part 3: Write a perl program that replaces all digits with the name of the digit, so every "0" is replaced with "zero" , "1" is replaced with "one", ... "9" is replaced with "nine". Test your program with your own input file containing digits and letters. Your program should write the result to output file and you need to print both input and output files along with your source code.

solar.txt:Adrastea XV Jupiter 129000 0.30 0.00 0.00 Jewitt 1979
Amalthea V Jupiter 181000 0.50 0.40 0.00 Barnard 1892
Ananke XII Jupiter 21200000 -631 147.00 0.17 Nicholson 1951
Ariel I Uranus 191000 2.52 0.00 0.00 Lassell 1851
Atlas XV Saturn 138000 0.60 0.00 0.00 Terrile 1980
Belinda XIV Uranus 75000 0.62 0.03 0.00 Voyager2 1986
Bianca VIII Uranus 59000 0.43 0.16 0.00 Voyager2 1986
Caliban XVI Uranus 7169000 -580 140. 0.08 Gladman 1997
Callirrhoe XVII Jupiter 24100000 ? ? ? Sheppard 2000
Callisto IV Jupiter 1883000 16.69 0.28 0.01 Galileo 1610
Calypso XIV Saturn 295000 1.89 0.00 0.00 Pascu 1980
Carme XI Jupiter 22600000 -692 163.00 0.21 Nicholson 1938
Chaldene XXI Jupiter 23387000 -733.7 165.2 0.238 Sheppard 2000
Charon I Pluto 20000 6.39 98.80 0.00 Christy 1978
Cordelia VI Uranus 50000 0.34 0.14 0.00 Voyager2 1986
Cressida IX Uranus 62000 0.46 0.04 0.00 Voyager2 1986
Deimos II Mars 23000 1.26 1.80 0.00 Hall 1877
Desdemona X Uranus 63000 0.47 0.16 0.00 Voyager2 1986
Despina V Neptune 53000 0.33 0.00 0.00 Voyager2 1989
Dione IV Saturn 377000 2.74 0.02 0.00 Cassini 1684
Earth III Sun 149600000 365.26 0.00 0.02 - -
Elara VII Jupiter 11737000 259.65 28.00 0.21 Perrine 1905
Enceladus II Saturn 238000 1.37 0.02 0.00 Herschel 1789
Epimetheus XI Saturn 151000 0.69 0.34 0.01 Walker 1980
Erinome XXV Jupiter 23279000 728 164.9 0.266 Sheppard 2000
Europa II Jupiter 671000 3.55 0.47 0.01 Galileo 1610
Galatea VI Neptune 62000 0.43 0.00 0.00 Voyager2 1989
Ganymede III Jupiter 1070000 7.15 0.19 0.00 Galileo 1610
Harpalyke XXII Jupiter 21132000 623.3 148.6 0.226 Sheppard 2000
Helene XII Saturn 377000 2.74 0.20 0.01 Laques 1980
Himalia VI Jupiter 11480000 250.57 28.00 0.16 Perrine 1904
Hyperion VII Saturn 1481000 21.28 0.43 0.10 Bond 1848
Iapetus VIII Saturn 3561000 79.33 14.72 0.03 Cassini 1671
Io I Jupiter 422000 1.77 0.04 0.00 Galileo 1610
Iocaste XXIV Jupiter 20216000 ? ? ? Sheppard 2000
Isonoe XXVI Jupiter 23078000 ? ? ? Sheppard 2000
Janus X Saturn 151000 0.69 0.14 0.01 Dollfus 1966
Juliet XI Uranus 64000 0.49 0.06 0.00 Voyager2 1986
Jupiter V Sun 778330000 4332.71 1.31 0.05 - -
Kalyke XXIII Jupiter 23745000 ? ? ? Sheppard 2000
Larissa VII Neptune 74000 0.55 0.00 0.00 Reitsema 1989
Leda XIII Jupiter 11094000 238.72 27.00 0.15 Kowal 1974
Lysithea X Jupiter 11720000 259.22 29.00 0.11 Nicholson 1938
Mars IV Sun 227940000 686.98 1.85 0.09 - -
Megaclite XIX Jupiter 23911000 ? ? ? Sheppard 2000
Mercury I Sun 57910000 87.97 7.00 0.21 - -
Metis XVI Jupiter 128000 0.29 0.00 0.00 Synnott 1979
Mimas I Saturn 186000 0.94 1.53 0.02 Herschel 1789
Miranda V Uranus 130000 1.41 4.22 0.00 Kuiper 1948
Moon I Earth 384000 27.32 5.14 0.05 - -
Naiad III Neptune 48000 0.29 0.00 0.00 Voyager2 1989
Neptune VIII Sun 4504300000 60190.00 1.77 0.01 Adams 1846
Nereid II Neptune 5513000 360.13 29.00 0.75 Kuiper 1949
Oberon IV Uranus 583000 13.46 0.00 0.00 Herschel 1787
Ophelia VII Uranus 54000 0.38 0.09 0.00 Voyager2 1986
Pan XVIII Saturn 134000 0.58 0.00 0.00 Showalter 1990
Pandora XVII Saturn 142000 0.63 0.00 0.00 Collins 1980
Pasiphae VIII Jupiter 23500000 -735 147.00 0.38 Melotte 1908
Phobos I Mars 9000 0.32 1.00 0.02 Hall 1877
Phoebe IX Saturn 12952000 -550.48 175.30 0.16 Pickering 1898
Pluto IX Sun 5913520000 90550 17.15 0.25 Tombaugh 1930
Portia XII Uranus 66000 0.51 0.09 0.00 Voyager2 1986
Praxidike XXVII Jupiter 20964000 ? ? ? Sheppard 2000
Prometheus XVI Saturn 139000 0.61 0.00 0.00 Collins 1980
Prospero XVIII Uranus 16568000 -2019 152. 0.44 Holman 1999
Proteus VIII Neptune 118000 1.12 0.00 0.00 Voyager2 1989
Puck XV Uranus 86000 0.76 0.31 0.00 Voyager2 1985
Rhea V Saturn 527000 4.52 0.35 0.00 Cassini 1672
Rosalind XIII Uranus 70000 0.56 0.28 0.00 Voyager2 1986
Saturn VI Sun 1429400000 10759.50 2.49 0.06 - -
Setebos XIX Uranus 17681000 -2239 158. 0.57 Kavelaars 1999
Sinope IX Jupiter 23700000 -758 153.00 0.28 Nicholson 1914
Stephano XX Uranus 7948000 -674 143. 0.24 Gladman 1999
Sun - - - - - - - -
Sycorax XVII Uranus 12213000 -1289 153. 0.51 Nicholson 1997
Taygete XX Jupiter 23312000 ? ? ? Sheppard 2000
Telesto XIII Saturn 295000 1.89 0.00 0.00 Smith 1980
Tethys III Saturn 295000 1.89 1.09 0.00 Cassini 1684
Thalassa IV Neptune 50000 0.31 4.50 0.00 Voyager2 1989
Thebe XIV Jupiter 222000 0.67 0.80 0.02 Synnott 1979
Themisto XVIII Jupiter 7507000 ? ? ? Sheppard 2000
Titan VI Saturn 1222000 15.95 0.33 0.03 Huygens 1655
Titania III Uranus 436000 8.71 0.00 0.00 Herschel 1787
Trinculo XXI Uranus 8578000 -759 167.0 0.208 Gladman 2001
Triton I Neptune 355000 -5.88 157.00 0.00 Lassell 1846
Umbriel II Uranus 266000 4.14 0.00 0.00 Lassell 1851
Uranus VII Sun 2870990000 30685.00 0.77 0.05 Herschel 1781
Venus II Sun 108200000 224.70 3.39 0.01 - -

electricity.txt:

Here is a dissertation on physical science for your enlightenment.
I don't know where it came from so it must be true!

[ Update: This appears to have come from Dave Barry, and the same text
can be found as:

http://www.uk.research.att.com/~fms/electricity.html
http://rachel.albany.edu/~jc9334/barry1.html

and many other places on the web. I'd check with Dave, but he
doesn't respond to email any more (and life's too short for snail
mail) ]
.....................................................................


Today's scientific question is: What in the world is electricity and
where does it go after it leaves the toaster?

Here is a simple experiment that will teach you an important
electrical lesson: On a cool dry day, scuff your feet along a carpet,
then reach your hand into a friend's mouth and touch one of his dental
fillings. Did you notice how your friend twitched violently and cried
out in pain? This teaches one that electricity can be a very powerful
force, but we must never use it to hurt others unless we need to learn
an important lesson about electricity.

It also illustrates how an electrical circuit works. When you scuffed
your feet, you picked up batches of "electrons", which are very small
objects that carpet manufacturers weave into carpet so that they will
attract dirt. The electrons travel through your bloodstream and
collect in your finger, where they form a spark that leaps to your
friend's filling, then travel down to his feet and back into the
carpet, thus completing the circuit.

AMAZING ELECTRONIC FACT: If you scuffed your feet long enough without
touching anything, you would build up so many electrons that your
finger would explode! But this is nothing to worry about unless you
have carpeting.

Although we modern persons tend to take our electric lights, radios,
mixers, etc. for granted, hundreds of years ago people did not have
any of these things, which is just as well because there was no place
to plug them in. Then along came the first Electrical Pioneer,
Benjamin Franklin, who flew a kite in a lightning storm and received a
serious electrical shock. This proved that lightning was powered by
the same force as carpets, but it also damaged Franklin's brain so
severely that he started speaking only in incomprehensible maxims,
such as, "A penny saved is a penny earned." Eventually he had to be
given a job running the post office.

After Franklin came a herd of Electrical Pioneers whose names have
become part of our electrical terminology: Myron Volt, Mary Louise
Amp, James Watt, Bob Transformer, etc. These pioneers conducted many
important electrical experiments. Among them, Galvani discovered
(this is the truth) that when he attached two different kinds of metal
to the leg of a frog, an electrical current developed and the frog's
leg kicked, even though it was no longer attached to the frog, which
was dead anyway. Galvani's discovery led to enormous advances in the
field of amphibian medicine. Today, skilled veterinary surgeons can
take a frog that has been seriously injured or killed, implant pieces
of metal in its muscles, and watch it hop back into the pond --
almost.

But the greatest Electrical Pioneer of them all was Thomas Edison, who
was a brilliant inventor despite the fact that he had little formal
education and lived in New Jersey. Edison's first major invention in
1877 was the phonograph, which could soon be found in thousands of
American homes, where it basically sat until 1923, when the record was
invented. But Edison's greatest achievement came in 1879 when he
invented the electric company. Edison's design was a brilliant
adaptation of the simple electrical circuit: the electric company
sends electricity through a wire to a customer, then immediately gets
the electricity back through another wire, then (this is the brilliant
part) sends it right back to the customer again.

This means that an electric company can sell a customer the same batch
of electricity thousands of times a day and never get caught, since
very few customers take the time to examine their electricity closely.
In fact, the last year any new electricity was generated was 1937.

Today, thanks to men like Edison and Franklin, and frogs like
Galvani's, we receive almost unlimited benefits from electricity. For
example, in the past decade scientists have developed the laser, an
electronic appliance so powerful that it can vaporize a bulldozer 2000
yards away, yet so precise that doctors can use it to perform delicate
operations to the human eyeball, provided they remember to change the
power setting from "Bulldozer" to "Eyeball."

Explanation / Answer

PART 3 :

perl program for that replaces all digits with the name of the digit :

unless (open(myinputfile, "in.txt")) {

die ("cannot open input file in.text ");

}

unless (open(myoutputfile, ">out.txt")) {

die ("cannot open output file out.txt ");

}
my(@lines) = <myinputfile>; # taking input data
my($line);
foreach $line (@lines) # loop for taking line by line
{
print "$line";
@chars=$line;
while($chars ne " ")# loop for taking character in line
{
use switch;
switch($chars) # for changing digits into chracter form
case 1 print myoutputfile ("one");
case 2 print myoutputfile ("two");
case 3 print myoutputfile ("three");
case 4 print myoutputfile ("four");
case 5 print myoutputfile ("five");
case 6 print myoutputfile ("six");
case 7 print myoutputfile ("seven");
case 8 print myoutputfile ("eight");
case 9 print myoutputfile ("nine");
else print myoutputfile ($chars);
  
}

}
@ln = <myoutputfile>;#taking output data
print (@ln);#printing data in output file
close(myinputfiel);
close(myoutputfile);