Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(c) (10 marks) Add three different test cases to the following test table for the free from ingredient function, where water is the specified ingredient.

(c) (10 marks)

Add three different test cases to the following test table for the free from ingredient function, where water is the specified ingredient.

We have started with a case where all three dishes have no ingredients. State, giving a reason, whether this is an edge case.

(c) (10 marks)

Add three different test cases to the following test table for the free from ingredient function, where water is the specified ingredient.

We have started with a case where all three dishes have no ingredients. State, giving a reason, whether this is an edge case.

case menu ingredient output
all three dishes have no ingredients (('potato'), ('cheese'), ('apple')) 'water' True

-------------The question before this was

\\\\\(b) (8 marks)

Define a function that takes a menu comprising three dishes, and a specified ingredient, and outputs true if all the dishes on the menu are free from the specified ingredient. If any of the dishes on the menu contain the specified ingredient, the function outputs false.

A menu is represented as a list of three dishes.

A dish is represented as a non-empty list of non-empty strings, the first string being the name of the dish and the remaining strings being the ingredients of the dish.

A dish can have a name but no listed ingredients. Ingredients can be duplicated. If the name of the dish matches the specified ingredient, the function should output false.

For example, the menu:

Dish Ingredients
soup onion, potato, leek, celery
pizza bread, tomato, cheese, cheese
banana

would be represented in Python as:

menu = [ ['soup','onion','potato','leek','celery'], ['pizza','bread','tomato','cheese','cheese'], ['banana'] ]

This example menu is not free from banana.

Function: free from ingredient Inputs: Preconditions: Output: Postconditions:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

Prepare for a successful job interview.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago

Question

=+j Describe an effective crisis management program.

Answered: 1 week ago