The code should work exactly the same as given example.
The files:
----------------------------------------------------------------------------------------------------
-------- FILE NAME -------
album0
---------- FILE -------
<album>
323
Licensed to Ill
Beastie Boys
25.0
</album>
<album>
70
Enter the Wu_Tang: 36 Cham...
Wu Tang Clan
25.99
</album>
turning to Alice, she went on, `What's your name, child?'
and there stood the Queen in front of them, with her arms
folded,
<album>
115
Daydream Nation
Sonic Youth
5.0
</album>
<album>
414
52nd Street
Billy Joel
25.75
</album>
<sales>
2010-06-09,115,8255
2015-03-15,70,6264
2010-08-09,323,684
2012-01-06,323,7340
2009-01-01,414,13164
2017-04-02,70,3259
2015-06-05,323,2378
2015-03-05,115,9463
2010-12-10,414,12952
2013-05-29,323,1687
2013-04-07,115,1594
2015-10-19,70,1469
2011-10-07,414,10867
2006-04-14,115,5806
2014-11-27,70,9864
2006-08-22,323,7088
2017-12-19,115,5970
2012-04-16,414,16813
2007-05-13,414,11626
2006-09-18,70,2641
2006-12-29,323,5578
</sales>
----------------------------------------------------------------------------------------------------
-------- FILE NAME -------
album1
---------- FILE -------
<album>
445
12 Songs
Randy Newman
20.75
</album>
<album>
291
Cheap Trick at Budokan
Cheap Trick
25.5
</album>
crept a little way out of the wood to listen.
such confusion that she never knew whether it was her turn or
`Why,' said the Dodo, `the best way to explain it is to do
it.'
<album>
207
Good Old Boys
Randy Newman
35.5
</album>
<album>
216
All the Young Dudes
Mott the Hoople
25.0
</album>
Some of the birds hurried off at once: one old Magpie began
<sales>
2014-08-18,291,3290
2014-12-10,216,8571
2009-08-06,207,4894
2017-12-04,445,774
2010-06-17,207,8012
2016-11-10,291,3851
2012-07-04,291,9997
2016-11-06,445,3866
2012-10-10,216,11404
2016-06-22,216,8393
2016-04-07,207,5836
2014-06-14,216,6707
2017-03-05,216,8164
2017-09-27,445,2956
2017-09-16,216,11508
2012-12-08,216,7101
2008-06-07,207,6340
2012-05-31,207,502
2007-11-13,216,11664
2015-04-24,445,3185
2018-05-10,291,3470
2018-01-29,445,1513
2015-02-22,291,5345
2007-08-26,207,1916
</sales>
----------------------------------------------------------------------------------------------------
-------- FILE NAME -------
album2
---------- FILE -------
<album>
462
Fresh Cream
Cream
10.0
</album>
<album>
273
Gris-Gris
Dr. John, the Night Tripper
20.95
</album>
<album>
15
(pronounced 'leh-'nerd 'sk...
Lynyrd Skynyrd
20.75
</album>
(`I only wish it was,' the March Hare said to itself in a
<album>
156
The Paul Butterfield Blues...
The Paul Butterfield Blues...
5.1
</album>
Alice sighed wearily. `I think you might do something better
<album>
124
Voodoo
D'Angelo
35.99
</album>
angrily.
mouse, That he
`but a grin without a cat! It's the most curious thing I ever
those serpents! There's no pleasing them!'
<album>
349
"Love and Theft"
Bob Dylan
35.0
</album>
by an occasional exclamation of `Hjckrrh!' from the Gryphon,
and
They very soon came upon a Gryphon, lying fast asleep in
the
Alice said nothing: she had never been so much contradicted
in
<album>
208
Raising Hell
Run D.M.C.
35.5
</album>
<sales>
2006-07-28,124,7749
2011-10-08,273,1351
2013-05-09,273,2592
2015-12-10,124,5853
2013-03-04,208,56195
2015-08-23,156,1550
2009-09-10,462,3238
2008-03-22,349,1005
2018-06-28,156,2547
2009-04-14,156,4419
2008-05-16,156,6108
2014-06-13,124,4156
2007-11-02,208,57926
2006-06-13,156,1416
2006-12-01,349,3141
2015-05-05,15,1580
2011-11-13,208,57862
2007-08-10,462,2103
2013-09-22,462,3746
2012-03-29,349,1205
2009-06-23,156,3210
2017-11-17,349,5136
2019-02-26,208,58573
2017-06-13,208,58446
2018-11-04,15,5519
2012-11-03,273,3937
2008-02-22,124,1750
2008-02-27,15,5218
2014-09-01,124,7828
2008-02-17,349,120
2007-10-11,208,57721
2010-01-30,462,4770
2006-08-30,15,2399
2007-02-11,462,1253
2009-05-20,15,68
2010-05-02,15,2229
2010-02-23,208,56622
2008-07-08,462,4857
2009-03-26,349,46
2009-03-08,208,57068
2014-12-01,15,3642
2012-09-11,156,5609
2018-01-10,349,2888
2017-12-04,208,58171
2015-06-12,273,2636
2018-03-07,124,6244
2012-03-11,462,2709
2014-12-29,273,6484
2012-01-18,462,2856
2007-09-21,156,2229
2006-11-10,273,1665
2015-03-09,349,5114
2009-10-27,15,6213
2017-12-08,349,2926
</sales>
SOURCE CODE:
import os #importing os module
while(True):
file=input("Enter a data file name:
") #reading file name from user
t=os.path.isfile(file) #this
statement is used to check entered string is file or not
if(t==True): #if it is
file
f=open(file,'r')
#opening file in read mode
line=f.readline()
l=[]
album_dictionary={}
while
line: #logic for reading line in line by
line
line=line.rstrip('\n') #deleting ending '\n' character from the
line
l.append(line) #appending line to list l
line=f.readline() #reading line
ind=l.index('<sales>') #finding index of
'<sales>'
del
l[ind:len(l)] #deleting sales section in the
list
for i in
range(len(l)):
if(l[i]=='<album>'):
album_dictionary.update({int(l[i+1]):l[i+2]}) #adding album id and
album name to album_dictionary
print() #printing
new line
print("Album Catalogue
Summary") #printing "Album Catalogue Summary"
s='-'
fs='{:<5}{:<30}'
#string for formating output
print(35*s)
#printing 35 '-' characters
print(fs.format("ID","ALBUM NAME")) #printing ID and
ALBUM NAME with appropriate format string
for k in
sorted(album_dictionary.keys()):
print(fs.format(k,album_dictionary[k])) #logic
for printing ID AND NAME in sorted order
break
else: #if it is not file
print("Invalid File Name
Entered!")
CODE
SCREENSHOT:
OUTPUT:
The code should work exactly the same as given example. The files: ---------------------------------------------------...
Code with Java using arrays and Scanner only ( input should end with 0 to terminate the program) Everyone loves to be celebrated on their birthdays. Birthday celebration can encourage positive social interaction among co-workers, foster friendship among classmates or even strengthen bond between families. Birthday graph can be display in many forms. It can a creative drawing consists of cupcakes, balloons, candles with names, or it can be in the form of simple bar chart to indicate the birthday...
Need help with C++ assignment Assignment 1 and .txt files are provided at the bottom. PART A PART B Assignment 1 #include <iostream> #include <string> #include <fstream> #include <iomanip> #include <stdio.h> #include <ctype.h> #include <string.h> #include <algorithm> using namespace std; /** This structure is to store the date and it has three integer fields **/ struct Date{ int day; int month; int year; }; /** This structure is to store the size of the box and it...
Java code BIRTHDAY GRAPH5 4B Input Standard input Output Standard output Topic Array & Array Processing Birthday Graph Problem Description Everyone loves to be celebrated on their birthdays. Birthday celebration can encourage positive social E interaction among co-workers, foster friendship among classmates or even strengthen bond between E BOBO Birthday graph can be display in many forms. It can a creative drawing consists of cupcakes, balloons, UU candles with names, or it can be in the form of simple bar...
The Primary Key of the table recording this information is SheepID+WeighingDate. The table has not been normalized beyond First Normal Form. That is, there are no ‘repeating groups’, but there may be Partial and Transitive Dependencies. SheepID Owner Birthdate WeighingDate Vet Weight VetPhoneNum K3922 McNab013 2013-05-12 2013-08-14 M330 22 7633088852 K3922 McNab013 2013-05-12 2014-06-02 S929 34 7609865463 K3922 McNab013 2013-05-12 2015-08-02 M330 43 7633088852 K3922 McNab013 2013-05-12 2016-07-30 P301 53 7682907965 K3922 McNab013 2013-05-12 2017-08-12 P301 52 7682907965 K3922 McNab013...
Using python beginner code see example code of what to use for this assignment we have gathered together some interesting data into a file called harvardLightning.txt The file contains all recorded lightning strikes in the harvard area Parsing Review alist = str.split() # alist will contain the elements of str - split using whitespace Specifying a delimiter Examples: delimiter = ',' delimiter = '-', delimiter = ';' Stripping specified characters Example: astring.strip('\n') Avoid blank lines: if len(line) == 0: ...
The Employee table consists of the following data fields: Employee ID, Employee Name, Employee Department, Employee Manager (EMP_ID of the Employee to whom the employee reports) and Employee DOH (Date of Hire). Using the following data table, answer the questions with appropriate SQL queries. EMP_ID EMP_NAME EMP_DEPT EMP_MANAGER EMP_DOH 1 John IT 9 05-08-2010 2 Alex Finance 0 06-03-2008 3 Linda IT 9 07-02-2010 4 Robin Purchase 8 08-12-2010 5 Maki Purchase 8 09-08-2012 6 Ross Sales 7 10-05-2012 7...
Need help writing a program that meets pseudocode and criteria . Txt File below input.txt file data 05 11/30/16 03 12/07/16 05 12/07/16 05 12/08/16 01 12/10/16 07 12/11/16 07 12/14/16 06 12/15/16 02 12/21/16 05 12/21/16 06 12/22/16 07 12/22/16 08 12/23/16 07 12/23/16 07 12/23/16 07 12/23/16 08 12/24/16 08 12/24/16 07 12/24/16 03 12/26/16 05 12/26/16 07 12/28/16 04 12/29/16 07 01/01/17 06 01/03/17 07 01/03/17 08 01/05/17 05 01/10/17 04 01/17/17 08 01/17/17 07 01/18/17 07...
The data set below are the unemployment rates from April 2016 through March 2018. The mean unemployment rate is 4.5, the median unemployment rate is 4.5, and the standard deviation of 0.33. Describe the data set using these statistics. Does the data appear to be consistent on a monthly basis? Year/Month Unemployment rate 2016-04 5.0 2016-05 2016-06 2016-07 2016-08 2016-09 2016-10 2016-11 2016-12 2017-01 2017-02 2017-03 2017-04 MacBook Pro 2017-05 4.3 2017-06 4 2017-07 4.3 2017-08 4.4 2017-09 4.2 2017-10...
Tracking the Shipment DatesRadan Logistics is a mid sized Shipping Company known for its Customer oriented delivery services. The Company Management intended to place an information kiosk in their Head Office which would help their Customers to fetch all the desired information with regards to their shipment. One such vital information that Customers would prefer to know is the details of the working days of the Company which would help them track their shipments.Help the Management write a program for...