Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Provide a user interface to look up the CPI values for any year. The program should read a year number from the keyboard and print

Provide a user interface to look up the CPI values for any year. The program should read a year number from the keyboard and print out the list of CPI values for that year. After that, it should print out the average CPI for that year (by computing the average of the reported list).
Enter query: 1950
[23.5,23.5,23.6,23.6,23.7,23.8,24.1,24.3,24.4,24.6,24.7,25.0]24.066666666666666
Enter query: 2000
[168.8,169.8,171.2,171.3,171.5,172.4,172.8,172.8,173.7,174.0,174.1,174.0]172.19999999999996
Enter query:
Enhance the program by allowing the user to specify the list of months they want to see. A valid query may in addition to the year number contain a list of month numbers separated by spaces.
For example, 19501357 requests the data for January, March, May, and July of 1950. If the months are not specified, report full year. The average should be computed only for the reported months.
Enter query: 1950
[23.5,23.5,23.6,23.6,23.7,23.8,24.1,24.3,24.4,24.6,24.7,25.0]24.066666666666666
Enter query: 19501357
[23.5,23.6,23.7,24.1]23.725
Enter query: 195056
[23.7,23.8]23.75
Enter query:

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

ISBN: 1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

what is a profit sharing plan

Answered: 1 week ago