Answered step by step
Verified Expert Solution
Question
1 Approved Answer
R language IceCreamPrice 0 # Add your code here }
R language IceCreamPrice <- function(numScoops, wantChocolate, wantCaramel, wantSprinkles) { # Returns the total price of an ice cream order with 'numScoops' number of # scoops. Each scoop costs $2.50. # 'wantChocolate', 'wantCaramel', and 'wantSprinkles' indicate whether or not # the customer wants certain toppings. # # Each topping is an extra $0.50. However, a customer can not order chocolate and # caramel together. If they do this, a price of -1 should be returned, # indicating a bad order. # # The maximum number of scoops for an order is 3. If 'numScoops' is more than # 3, a price of -1 should be returned. # Precondition: 'numScoops' > 0 # Add your code here }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started