I am a web design student and i have a programming assignment due on friday and I am just stumped. It has to be in ptyhon and it uses arrays which i just dont understand. this is the assignment...
Write the Python code for the following programming problem. You have an option of writing the Pseudo code instead if you are looking for partial marks.
The program/ pseudo code must be modular and have describing comments where ever required. I definitely want your name, date and purpose of the program in comments at the head of the program. You will be using arrays to solve this problem.
Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the energy difference from the two years and display the two years worth of data, along with the savings.
Notes:
1)The program should use arrays and must be modular.
2)The program runs till the user decides to end the program. The user should enter “yes” (any combination of lower and upper case letters) if he/she wants to continue using the program.
3)The energy bills can be any dollar value (integer or real) in the range 500-1000, both inclusive. Give error message in case of invalid input and force the user to give a value in the range.
4)Printed dollar values must have a dollar sign and two digits after the decimal point.
and this is what the output should look like...
Your sample input might look as follows:
Enter NOT GREEN energy costs for January
Enter now -->789
Enter NOT GREEN energy costs for February
Enter now -->790
Enter NOT GREEN energy costs for March
Enter now -->890
Enter NOT GREEN energy costs for April
Enter now -->773
Enter NOT GREEN energy costs for May
Enter now -->723
Enter NOT GREEN energy costs for June
Enter now -->759
Enter NOT GREEN energy costs for July
Enter now -->690
Enter NOT GREEN energy costs for August
Enter now -->681
Enter NOT GREEN energy costs for September
Enter now -->782
Enter NOT GREEN energy costs for October
Enter now -->791
Enter NOT GREEN energy costs for November
Enter now -->898
Enter NOT GREEN energy costs for December
Enter now -->923
-----------------------------------------------------
Enter GONE GREEN energy costs for January
Enter now -->546
Enter GONE GREEN energy costs for February
Enter now -->536
Enter GONE GREEN energy costs for March
Enter now -->519
Enter GONE GREEN energy costs for April
Enter now -->493
Enter GONE GREEN energy costs for May
Enter now -->472
Enter GONE GREEN energy costs for June
Enter now -->432
Enter GONE GREEN energy costs for July
Enter now -->347
Enter GONE GREEN energy costs for August
Enter now -->318
Enter GONE GREEN energy costs for September
Enter now -->453
Enter GONE GREEN energy costs for October
Enter now -->489
Enter GONE GREEN energy costs for November
Enter now -->439
Enter GONE GREEN energy costs for December
Enter now -->516
Do you want to end program? (Enter no or yes): yes
Your sample output must look as follows:
SAVINGS
__________________________________________________ ___
SAVINGS NOT GREEN GONE GREEN MONTH
__________________________________________________ ___
$ 243.00 $ 789.00 $ 546.00 January
$ 254.00 $ 790.00 $ 536.00 February
$ 371.00 $ 890.00 $ 519.00 March
$ 280.00 $ 773.00 $ 493.00 April
$ 251.00 $ 723.00 $ 472.00 May
$ 327.00 $ 759.00 $ 432.00 June
$ 343.00 $ 690.00 $ 347.00 July
$ 363.00 $ 681.00 $ 318.00 August
$ 329.00 $ 782.00 $ 453.00 September
$ 302.00 $ 791.00 $ 489.00 October
$ 459.00 $ 898.00 $ 439.00 November
$ 407.00 $ 923.00 $ 516.00 December
Any help or advice would be greatly appreciated, Even if anyone knows how to write it in psuedo-code that will work...I just need to submit something and I am terrible at programming!
i'd say check out the tutorial section,
everything is well explained there.
And at least start and try to do something,
instead of asking people to solve it for u,
that won't help u improve your programming (skills).
I know it's too late to reply and nobody will do homework for you (just keep in mind).
This is a very fun program, I might do it over the break just to practice python.
Array? Doesn't python treat everything like array (list, dictionary)???
there are only a few keywords really matter (beside lists)
for loop
range, len
something like that can write a okay-ish program with a lot of codes.
http://i3physics.com/blog
*-*-*-*__ C++ revolutionized the modern programming language, but what happen to C+? Programming is just a study of chemistry __*-*-*-*
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks