Question

5 5 - Parallel Arrays in Python Mind Tap - Cengage Lea x + V A https//ng.cengage.com/static/nb/ui/evo/index.html?deploymentid

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

# JumpinJava.py - This program looks up and prints the names and prices of coffee orders.  

# Input:  Interactive

# Output:  Name and price of coffee orders or error message if add-in is not found

# Declare variables.

NUM_ITEMS = 5 # Named constant

# Initialized list of add-ins

addIns = ["Cream", "Cinnamon", "Chocolate", "Amaretto", "Whiskey"]


# Initialized list of add-in prices

addInPrices = [.89, .25, .59, 1.50, 1.75]

foundIt = False # Flag variable

orderTotal = 2.00  # All orders start with a 2.00 charge

# Get user input

addIn = input("Enter coffee add-in or XXX to quit: ")

#check whether entered string is exit or search word

while addIn!="XXX":

    foundIt = False

    # check in the range list elements

    for i in range(NUM_ITEMS):

        if addIns[i].lower()==addIn.lower():

            foundIt = True

            #Name and price of coffee orders

            print("Name:",addIns[i],"price of coffee", addInPrices[i])

            orderTotal += addInPrices[i]

    if foundIt==False:

        #error message if add-in not in list

        print("Name:",addIn," not found")

    addIn = input("Enter coffee add-in or XXX to quit: ")

print("Order total", orderTotal)

print("You choose exit. Thank you")

nagarajuanagaraju-Vostro-3550:07122019$ python3 Jumpinjava.py Enter coffee add-in or XXX to quit: Cream Name: Cream price of

Add a comment
Know the answer?
Add Answer to:
5 5 - Parallel Arrays in Python Mind Tap - Cengage Lea x + V A...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to...

    Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to complete a partially completed Java program. The program should either print the name and price for a coffee add-in from the Jumpin’ Jive coffee shop or it should print the message: "Sorry, we do not carry that.". Read the problem description carefully before you begin. The data file provided for this lab includes the necessary variable declarations and input statements. You need to write...

  • This program will simulate buying a cup of coffee. The initial cost of a cup of...

    This program will simulate buying a cup of coffee. The initial cost of a cup of coffee will be $2.00 (without adding items). This program will demonstrate a concept called parallel arrays. Parallel arrays are arrays that have the same number of items. For Python we will use lists. You will have a list that holds addingitems which will consist of a list equal to Cream, Caramel, Whiskey, Chocolate, Cinnamon and Vanilla. You will then have a parallel list of...

  • The Jumpin Jive coffee shop charges $2 for a cup of coffee and offers add ins...

    The Jumpin Jive coffee shop charges $2 for a cup of coffee and offers add ins shown in the pseudocode. Using the following Pseudocode, Design the logic for an application that allows a user to enter ordered add ins continuously until a sentinel value is entered. After each item, display its price or the message "Sorry, we do not carry that" as an output. After all items have been entered, display the total price for the order. Please write it...

  • I need the pseudocode and python for the four attached problems: 1. (Chapter 5 - For...

    I need the pseudocode and python for the four attached problems: 1. (Chapter 5 - For Loop) Logic Technical College has a current tuition of $10,000 per year. Tuition is scheduled to increase by 5% each year. Using a FOR loop, design a program that calculates and displays the tuition each year for the next ten years, like so: The tuition for year 1 will be: 10500.00 The tuition for year 2 will be: 11025.00 ……….. (You, of course will...

  • C++ Please     Contact list - functions & parallel arrays/CStrings No Vectors can be used since we...

    C++ Please     Contact list - functions & parallel arrays/CStrings No Vectors can be used since we haven't learned them yet !! A contact list is a place where you can store a specific information with other associated information such as a phone number, email address, birthday, etc. Write a program that will read 5 data pairs into two parallel arrays. Data pairs consist of a name (as a CString) and a GPA (double). That list is followed by a name,...

  • Zybooks 11.12 LAB*: Program: Online shopping cart (continued) Python 3 is the code needed and this...

    Zybooks 11.12 LAB*: Program: Online shopping cart (continued) Python 3 is the code needed and this is in Zybooks Existing Code # Type code for classes here class ItemToPurchase: def __init__(self, item_name="none", item_price=0, item_quantity=0): self.item_name = item_name self.item_price = item_price self.item_quantity = item_quantity # def __mul__(self): # print_item_cost = (self.item_quantity * self.item_price) # return '{} {} @ ${} = ${}' .format(self_item_name, self.item_quantity, self.item_price, print_item_cost) def print_item_cost(self): self.print_cost = (self.item_quantity * self.item_price) print(('{} {} @ ${} = ${}') .format(self.item_name, self.item_quantity, self.item_price,...

  • Please write code using Python. Rubric Assignment Solution Total: 100 pts Program successfully retrieves and validates...

    Please write code using Python. Rubric Assignment Solution Total: 100 pts Program successfully retrieves and validates user input 15 pts Morse Code Function Created 10 pts Function Uses Parameters to get input message 15 pts Function successfully converts passed message to Morse Code and returns the Morse Code equivalent of message 45 pts Program calls Morse Code function and outputs the result of the function (i.e. the actual Morse Code) 15 pts Main Function Requirement Part 2 MUST have a...

  • Can someone please help me with this Python code? Thank you in advance, Zybooks keeps giving me e...

    Can someone please help me with this Python code? Thank you in advance, Zybooks keeps giving me errors. Thanks in advance!! This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program). (1) Extend the ItemToPurchase class to contain a new attribute. (2 pts) item_description (string) - Set to "none" in default constructor Implement the following method for the ItemToPurchase class. print_item_description() - Prints item_description attribute for an ItemToPurchase object. Has an ItemToPurchase parameter. Ex. of...

  • Write the code in python, if you cannot answer all the question please dont anser, thanx very much. Please gimme a scr...

    Write the code in python, if you cannot answer all the question please dont anser, thanx very much. Please gimme a screen shot for code. Write clear code with comments and follow coding convention. Comments should include your name, student number and subject code on top of your code Question 1 Create a list to store all the subject codes that you are currently doing at UOW Then use for loop to display it in a table as in the...

  • This is Python The program should accept input from the user as either 7-digit phone number...

    This is Python The program should accept input from the user as either 7-digit phone number or 10-digit. If the user enters 7 characters, the program should automatically add "512" to the beginning of the phone number as the default area code. Dash (hyphen) characters do not count in input character count, but must not be random. If the user enters dashes the total character count must not exceed 12. The program should not crash if the user enters invalid...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT