In: Computer Science
write code in python and test
Conversation with an AI ChatBot
Learning Outcomes:
Use the print() function to output a variety of
data
Use the input() function to ask for multiple data
types
Use basic arithmetic operations in a program
Use string methods and operations
Use if/else if/else statements to determine the flow
of the program
Comment your code
Debug your code
Test your code
Scenario
A new marketing company is launching an Artificial
Intelligence (AI) ChatBot for their website and want you to code a
prototype demonstration for their investors. Simulate a "sales
conversation" with a customer who will be purchasing licenses for
your ChatBot service.
Your code must do the following:
Ask for the customer's first and last name. Store the
values input to a variable.
Greet your customer using their full name.
Provide a few sentence overview of your Chatbot
program. Be creative - make some stuff up. Output it to the screen
with a nice format of your choice. Make this as serious or as silly
a scenario as you want it to be.
Ask if your customer would like to make a
purchase.
If yes -- continue to the following items:
Ask for their email address. Store the values input to
a variable.
Ask for their phone number. Store the values input to
a variable.
Ask for how many chatbot licenses they would like to
purchase. Store the values input to a variable.
Ask if they would also like to purchase an optional Gold Support plan that gets them priority support.
The Gold Support plan costs $500/year for license
purchases 1 - 50.
The Gold Support plan costs $350/year for license
purchases 51 - 100.
The Gold Support plan costs $250/year for license
purchases 100+.
Each chatbot license costs $75. Calculate and display
their current total. Store the values input to a
variable.
Apply 10% tax for the total bill.
Calculate the total amount due. Store the values input
to a variable.
Ask for a credit card number. Store the values input
to a variable.
Ask for a credit card expiration date. Store the
values input to a variable.
Ask for a CVC number on the back of the credit card.
Store the values input to a variable.
Ask for a zip code. Store the values input to a
variable.
Output a receipt using all of the variables you have
input. Be sure to show the total license number, the amount for
each license, the subtotal, tax, and total amount due.
In the receipt output, include the customer's name,
phone number, email address, the credit card number, and expiration
date.
If no - thank the customer by name and say
goodbye.
Ask the customer if they would like to restart the
ChatBot.
For advanced coders extra
If you want an extra challenge, modify the scenario above with THREE different ChatBot service plans (instead of only the $75.00 version). Perhaps have a LITE, STANDARD, and ADVANCED ChatBot plan. Ask the user how many of each service plans they would like to purchase and calculate the totals based on the price of each plan.
(write code in python and test )
// Python programm for above question
print("Please let me know your
name:")
// Asking customer's name
Fname = input("First name: ")
//Taking first name as input
Lname = input("Last name: ")
//Taking last name as input
print(" Welcome to chatbot service", Fname, Lname) //
printing first name and last name
print("We provide chatbot service for your business and personal
purpose. Now do not worry , if you are busy or you are out of
station. We are there for you with our chatbot
service")
//Describing about chatbot service
print("Would you like to make purchase, If yes please enter
'1'") // Asking for decision
ask = int(input("Enter your decision: ")) //
taking decision as input
if
ask==1:
// checking customer decision
Email = input("Please enter your Email:
") //asking for email, phone and number of chatbot to
add
Phone = input("Please enter your Phone
number: ")
val = int(input("Number of chatbot you want to
purchase: "))
print("would you like to purchase other plans\n
The Gold Support plan costs $500/year for license purchases 1 -
50.\n The Gold Support plan costs $350/year for license purchases
51 - 100, \n The Gold Support plan costs $250/year for license
purchases 100+") // providin other offers
cost = 75
// cost per license
currtotal = val*75 //
calculating total price
print("Current price: $",
currtotal) //printing price without tax
tax = currtotal*0.1 //
calculating 10% tax
total = currtotal+tax //
calculating price including taxes
print("Total price: $", total)
// printing total price
//asking for credit card and
other personal details
cc= int(input("Enter credit card number:
"))
exp = int(input("Enter expiry date of your card:
"))
cvc = int(input("Enter CVC: "))
zip = int(input("Enter ZIP code:
"))
//producing reciept
print("Reciept")
print("Total license number: ", val)
print("Price of each license: $", cost)
print("Sub Total: $", currtotal)
print("TAX: $", tax)
print("Total: $", total)
// generating reciept for
customer
print("Reciept output")
print("Name: ", Fname, Lname)
print("Phone number: ", Phone)
print("Email: ", Email)
print("Credit Card number", cc)
print("CC expiry date", exp)
else:
print("Thank you, Good bye ", Fname,
Lname) // customer said No hence this
print("would you like to restart chatbot?") //
asking for restart
NOTE: Here I have used // to comment the code but in python language '''..................''' is used to comment the code.