Due Monday, September 12 at Midnight.
At the conclusion of this programming assignment, participants should be able to:
print()
statements, and collect input from the user with input()
Before starting this programming assignment, participants should be able to:
Content used in this assignment is based upon information in the following sources:
For this programming assignment, we are going to write a basic chatbot program (chatbot.py). For fun, you can try having a conversation with an online chatbot here. The chatbot we are going to design wants to know a few things about you! Such as:
Write a chatbot program that interacts with the user in the following manner:
<user's name>
! My name is <name of your chatbot>
".<location>
sounds like a pleasant place to be from!".<user's favorite number>
) is 1.5 times as big as my favorite number (7).<car>
as well.<car>
(integer)<car>
(float)<car>
(car price + interest), such as "Your monthly payment for the <car>
is <monthly payment>
, that is a total of <total cal cost>
!.<user's name>
.For calculating monthly payments, use the following formula:
$$mpymt = \frac{r(P)}{1 - (1 + r)^{-n}}$$Where $r$ is the monthly interest rate, $P$ is the cost of the car, and $n$ is the number of monthly payments. You can figure out $r$ by converting the interest rate the user enters to a decimal (divide by 100) and then dividing by 12 (12 months in a year).
You can check your program output by comparing the computed monthly payment to an online payment calculator.
Here is an example run of my "CarBot" program:
Hello there! My name is CarBot. What is your name?
Jane Student
Hello Jane Student, it is great to meet you!
Jane Student, where are you from?
Washington
Washington sounds like a pleasant place to grow up. Hmmmm, what else can I ask you... oh! What is your favorite number?
23
Your favorite number (23) is 3.3 times as big as my favorite number (7)
What is your dream car?
BMW i8
Wow, I have always wanted a BMW i8 as well. How much does a BMW i8 cost?
141695
What is a reasonable yearly interest rate on a beautiful car like that?
2.0
And if you had to take out a loan to buy the BMW i8, how many years would you take the loan out for?
5
If you bought the BMW i8, you would have a monthly payment of $2483.60, hopefully that is reasonable for your budget. That's a total of $149015.76! I hope you can make the purchase!
Anyways, I gotta go. It's been nice chattin' with ya Jane Student :)
Note: BMW has a loan estimator on their website. Try it for the i8 to check your work!
(Image from https://c2.staticflickr.com/8/7152/13650180553_2febc742d3_b.jpg)
Note: Your output does not have to exactly match mine above. It needs to be correct, but you are free to give your chatbot his/her own personality. Have fun with it!
<your last name>_pa1.zip
by the due date and time.This assignment is worth 50 points. Your assignment will be evaluated based on a successful compilation and adherence to the program requirements. We will grade according to the following criteria: