intro to python

Hi i need some hep for my homework its an intro to basic python class. i did help only with number 2 and 3 as number 1 i am basically done but just need a little help in the last bit to get the sum from the data. SO the there is only 3 question i am done with the first one but just need a little help and i uploading what i did so you can see. Thankyou i hope this helps
tea.txt

tea.txt

Don't use plagiarized sources. Get Your Custom Essay on
intro to python
Just from $13/Page
Order Essay

hw_5_no.docx

homework_5.pdf

Unformatted Attachment Preview

Green Tea:8580.0:7201.25:8900.0
Earl Grey:10225.25:9025.0:9505.0
Ceylon:6700.1:5012.45:6011.0
Jasmine:9285.15:8276.1:8705.0
Mint Tea:7901.25:4267.0:7056.5
Green Tea:8580.0:7201.25:8900.0
Earl Grey:10225.25:9025.0:9505.0
Ceylon:6700.1:5012.45:6011.0
Jasmine:9285.15:8276.1:8705.0
Mint Tea:7901.25:4267.0:7056.5
#Jonathan Tjitro
#1056769
#HW 5 NO.1
#TEA LEAVES SALES REPORT
infile = open(“tea.txt”, ‘r’)
teas=[]
em_tea=infile.readlines()
for tea in em_tea:
teas.append(tea.split(‘:’))
for x in range(0,len(em_tea)):
for y in range(0,len(teas[x])):
if y==0 :
print(teas[x][y], end =”)
else:
print(teas[x][y], end=’ ‘)
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type “copyright”, “credits” or “license()” for more information.
>>>
======== RESTART: /Users/jonathanlee/Desktop/python lab/HW 5 no.1.py
========
Green Tea8580.0 7201.25 8900.0
Earl Grey10225.25 9025.0 9505.0
Ceylon6700.1 5012.45 6011.0
Jasmine9285.15 8276.1 8705.0
Mint Tea7901.25 4267.0 7056.5
>>>
CS10 Python Programming Homework 5
40 points
Dictionaries, Files, OOP
1. You must turn in your program listing and output for each program set. Start a new sheet or sheets of paper
for each program set. Each program set must have your student name, student ID, and program set
number/description. All the program sets must be printed and submitted together with your Final Exam.
Once you complete your Final Exam and leave the classroom you will not be able to submit Homework 5.
Late homework will not be accepted for whatever reasons you may have.
********************************************************************************************************************************
for this homework, you are also to submit All Program Sets to Canvas under Homework 5 link
********************************************************************************************************************************
a.
Name your files : PS1_firstinitial_lastname.py for Program Set 1 and so on. PS means program
set.
b.
You still have to submit the paper copies together with the rest of the Homework 5.
c.
You have till 11:59pm on the day of Final Exam to submit all Program Sets to Canvas. If the
deadline is past, Program Sets will not be graded even if you submit the paper copy on time.
d.
You must submit both hardcopy and upload the Program Sets to Canvas to be graded. If you
only submit the hardcopy or only upload to Canvas you will receive a zero for the Program Sets.
You must submit all the hardcopies of all Program Sets of Homework 5.
e.
if you do not follow instructions on file naming provided in this section you will receive a zero for
the whole of Homework 4.
2. You must STAPLE (not stapled assignments will not be graded resulting in a zero score) your programming
assignment and collate them accordingly. Example Program set 1 listing and then output, followed by
Program Set 2 listing and output and so on.
3. Please format you output properly, for example all dollar amounts should be printed with 2 decimal places.
Make sure that your output values are correct (check the calculations).
4. Each student is expected to do their own work. IF IDENTICAL PROGRAMS ARE SUBMITTED, EACH
IDENTICAL PROGRAM WILL RECEIVE A SCORE OF ZERO.
Grading:
Each program set must run correctly syntactically, logically, and display the correct output as specified. If
the program set does not run correctly, a zero will be given. For each Program set, if the program executes
properly with proper syntax, logic, and displays the correct output, then points will be deducted for not having
proper:
a. Comments 1 pt
– Your name, description at the beginning of each program set. Short description of the what
each section of your codes do.
b. Consistency/Readability 2 pts
– Spacing(separate each section of codes with a blank line
– Indentation
– Style (proper naming of variables no a,b,c â?? use descriptive and mnemonics)
-each function must include type hints or annotations except for the main()
-include docstrings for every function
c. Required elements 2 pts
– Use tools that have been covered in class
– proper formatting for output when specified
– all monetary values must be in 2 decimal places
d. Output 3 points
– to be displayed at the end of the program listing(codes)
– must use test cases when provided
Program 1- Tea Leaves Sales Report (15 Points)
1.
Here is the sample of the text file (datafile) for the tea sales (tea.txt). You have to create this file yourself.
Green Tea:8580.0:7201.25:8900.0
Earl Grey:10225.25:9025.0:9505.0
Ceylon:6700.1:5012.45:6011.0
Jasmine:9285.15:8276.1:8705.0
Mint Tea:7901.25:4267.0:7056.5
The data reads as follows â?? tea_name:store1_Sales:store2_Sales:store3_Sales
2. The output displayed as follows:
>>>
Ceylon
Earl Grey
Green Tea
Jasmine
Mint Tea
6700.10
10225.25
8580.00
9285.15
7901.25
42691.75
5012.45
9025.00
7201.25
8276.10
4267.00
33781.80
6011.00
9505.00
8900.00
8705.00
7056.50
40177.50
17723.55
28755.25
24681.25
26266.25
19224.75
>>>
The last row is the store totals for all the kinds of tea leaves sold. The last column is the total sale for
each kind of tea leaves sales. Note that the tea names are sorted.
3. Write a program to read in the tea.txt textfile and then print the report as shown in #2 above.
4. You must use dictionary. You can also use list, tuples, sets if necessary.
Program 2 â?? OOP (10 points)
Write a program to calculate and display the loan for buying a car.
1.
Create a class call Loan.
Data fields in the Loan class include:
1
Annual Interest Rate (Float)
2.
Number of years of loan (Float)
3.
Loan Amount (Float)
4.
Borrowerâ??s Name (string)
2.
Create the initializer or constructor for the class with the above data fields. Make the data fields private.
3.
Create accessors (getter) for all the data fields.
4.
Create mutators (setters) for all the data fields.
5.
Create a class method

getMonthlyPayment where
monthlyPayment = loanAmount * monthlyInterestRate / (1 � (1 / (1 monthlyInterestRate) ** (numberOfYears * 12)))
note: that the monthly interest rate = annualinterest / 1200
5. Create a class method – getTotalPayment where
totalPayment = getMonthlyPayment() * numberOfYears * 12
7.
Write a test program (main function) to allow the user to enter the following:
1.
Annual Interest Rate
2.
Number of Years of Loan
3.
Loan Amount
4.
Borrowerâ??s Name
Allow the user to change the loan amount and reprint the new loan information.
The output should look like this:
>>>
Enter yearly interest rate, for example, 7.25: 2.5
Enter number of years as an integer: 5
Enter loan amount, for example, 120000.95: 1000.00
Enter a borrower’s name: John Jones
The loan is for John Jones
The monthly payment is 17.75
The total payment is 1064.84
Do you want to change the loan amount? Y for yes or enter to quit y
Enter new loan amount 5000
The loan is for John Jones
The monthly payment is 88.74
The total payment is 5324.21
>>>
Program Set 3 (15 points)
Use Program set 2 codes and use tkinter module to create a GUI program for the Loan program that looks like
the below image.

Purchase answer to see full
attachment

GradeAcers
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

Order your essay today and save 15% with the discount code DISCOUNT15