Write the pseudocode that will produce a receipt in the format specified above.
Your solution should satisfy the following requirements:
•Declare and initialise variables. Numeric variables must be initialised to zero.
•The shop keeper must be asked the following and answer with a 1 (Yes) or 0 (No)
Do you want to purchase tomatoes?
Do you want to purchase green beans? Do you want to purchase spinach?
•If the shop keeper answers 1 for any of the questions above, then input the kilos the shop keeper wants to buy for each of the items purchased•Calculate the cost for each vegetable (price x kilos)
•Calculate the total cost (before discount) •Determine if a discount must be applied to a vegetable
•Calculate the discount if required
•Calculate the final total due after the discount has been subtracted
•Output the slip in the format specified above
To generate a receipt in the specified format, here's an example of pseudocode that satisfies the given requirements:
```
DECLARE tomatoes, greenBeans, spinach AS Integer
DECLARE tomatoesKilos, greenBeansKilos, spinachKilos AS Float
DECLARE tomatoesCost, greenBeansCost, spinachCost, totalCost, discount, finalTotal AS Float
tomatoes = 0
greenBeans = 0
spinach = 0
INPUT "Do you want to purchase tomatoes? (1 for Yes, 0 for No): ", tomatoesChoice
INPUT "Do you want to purchase green beans? (1 for Yes, 0 for No): ", greenBeansChoice
INPUT "Do you want to purchase spinach? (1 for Yes, 0 for No): ", spinachChoice
IF tomatoesChoice = 1 THEN
INPUT "Enter the kilos of tomatoes you want to buy: ", tomatoesKilos
tomatoes = 1
ENDIF
IF greenBeansChoice = 1 THEN
INPUT "Enter the kilos of green beans you want to buy: ", greenBeansKilos
greenBeans = 1
ENDIF
IF spinachChoice = 1 THEN
INPUT "Enter the kilos of spinach you want to buy: ", spinachKilos
spinach = 1
ENDIF
tomatoesCost = 2.99 * tomatoesKilos
greenBeansCost = 1.99 * greenBeansKilos
spinachCost = 1.49 * spinachKilos
totalCost = tomatoesCost + greenBeansCost + spinachCost
IF tomatoesCost >= 10 THEN
discount = tomatoesCost * 0.1
ENDIF
IF greenBeansCost >= 10 THEN
discount = greenBeansCost * 0.1
ENDIF
IF spinachCost >= 10 THEN
discount = spinachCost * 0.1
ENDIF
finalTotal = totalCost - discount
OUTPUT "-------------------------"
OUTPUT "RECEIPT"
OUTPUT "-------------------------"
IF tomatoes = 1 THEN
OUTPUT "Tomatoes: ", tomatoesKilos, " kg - $", tomatoesCost
ENDIF
IF greenBeans = 1 THEN
OUTPUT "Green Beans: ", greenBeansKilos, " kg - $", greenBeansCost
ENDIF
IF spinach = 1 THEN
OUTPUT "Spinach: ", spinachKilos, " kg - $", spinachCost
ENDIF
OUTPUT ""
OUTPUT "Total Cost (before discount): $", totalCost
IF discount > 0 THEN
OUTPUT "Discount Applied: $", discount
ENDIF
OUTPUT "Final Total Due: $", finalTotal
OUTPUT "-------------------------"
```
Please note that the pseudocode above represents a solution concept and may require adaptation based on the specific programming language or environment being used.
Here is a pseudocode solution to generate the desired receipt:
```
DECLARE shopName, shopAddress, shopContact, shopWebsite AS String
DECLARE tomatoesPrice, beansPrice, spinachPrice, tomatoesKilos, beansKilos, spinachKilos, totalCost, discount AS Float
DECLARE purchaseTomatoes, purchaseBeans, purchaseSpinach AS Integer
SET shopName = "XYZ Grocery Store"
SET shopAddress = "123 Main Street, City"
SET shopContact = "+1 123-456-7890"
SET shopWebsite = "www.xyzgrocery.com"
SET tomatoesPrice = 2.5
SET beansPrice = 1.75
SET spinachPrice = 3.0
SET tomatoesKilos = 0
SET beansKilos = 0
SET spinachKilos = 0
SET totalCost = 0
SET discount = 0
PRINT "Welcome to " + shopName
PRINT "Address: " + shopAddress
PRINT "Contact: " + shopContact
PRINT "Website: " + shopWebsite
PRINT "-----------------------------------"
PRINT "Do you want to purchase tomatoes? (1: Yes, 0: No)"
INPUT purchaseTomatoes
IF purchaseTomatoes = 1 THEN
PRINT "Enter the quantity of tomatoes (in kilograms):"
INPUT tomatoesKilos
totalCost = totalCost + (tomatoesPrice * tomatoesKilos)
END IF
PRINT "Do you want to purchase green beans? (1: Yes, 0: No)"
INPUT purchaseBeans
IF purchaseBeans = 1 THEN
PRINT "Enter the quantity of green beans (in kilograms):"
INPUT beansKilos
totalCost = totalCost + (beansPrice * beansKilos)
END IF
PRINT "Do you want to purchase spinach? (1: Yes, 0: No)"
INPUT purchaseSpinach
IF purchaseSpinach = 1 THEN
PRINT "Enter the quantity of spinach (in kilograms):"
INPUT spinachKilos
totalCost = totalCost + (spinachPrice * spinachKilos)
END IF
IF totalCost > 0 THEN
PRINT "-----------------Receipt-----------------"
IF purchaseTomatoes = 1 THEN
PRINT "Tomatoes: $" + (tomatoesPrice * tomatoesKilos)
END IF
IF purchaseBeans = 1 THEN
PRINT "Green Beans: $" + (beansPrice * beansKilos)
END IF
IF purchaseSpinach = 1 THEN
PRINT "Spinach: $" + (spinachPrice * spinachKilos)
END IF
PRINT "-----------------------------------"
PRINT "Total Cost (before discount): $" + totalCost
IF totalCost >= 10 THEN
discount = 0.1 * totalCost
totalCost = totalCost - discount
PRINT "Discount (10%): $" + discount
END IF
PRINT "Total Due: $" + totalCost
ELSE
PRINT "No items were purchased."
END IF
```
Please note that this is a pseudocode representation, and you will need to adapt it to the programming language you are using.
Here is a pseudocode solution to generate a receipt as per the requirements:
```
DECLARE tomatoes, greenBeans, spinach, tomatoPrice, greenBeanPrice, spinachPrice, tomatoWeight, greenBeanWeight, spinachWeight, totalCost, discount, finalTotalCost AS NUMERIC
tomatoes = 0
greenBeans = 0
spinach = 0
tomatoPrice = 2.5 // Price per kilo for tomatoes
greenBeanPrice = 3.0 // Price per kilo for green beans
spinachPrice = 1.8 // Price per kilo for spinach
totalCost = 0
discount = 0
finalTotalCost = 0
WRITE "Do you want to purchase tomatoes? (Enter 1 for Yes, 0 for No): "
READ tomatoes
IF tomatoes == 1 THEN
WRITE "Enter the weight of tomatoes in kilos: "
READ tomatoWeight
totalCost = totalCost + (tomatoPrice * tomatoWeight)
WRITE "Do you want to purchase green beans? (Enter 1 for Yes, 0 for No): "
READ greenBeans
IF greenBeans == 1 THEN
WRITE "Enter the weight of green beans in kilos: "
READ greenBeanWeight
totalCost = totalCost + (greenBeanPrice * greenBeanWeight)
WRITE "Do you want to purchase spinach? (Enter 1 for Yes, 0 for No): "
READ spinach
IF spinach == 1 THEN
WRITE "Enter the weight of spinach in kilos: "
READ spinachWeight
totalCost = totalCost + (spinachPrice * spinachWeight)
IF totalCost > 10 THEN
discount = 0.1 * totalCost // 10% discount if total cost exceeds 10
finalTotalCost = totalCost - discount
ELSE
finalTotalCost = totalCost
WRITE "---------------------- RECEIPT ----------------------"
IF tomatoes == 1 THEN
WRITE "Tomatoes (", tomatoWeight, "kg) : $", (tomatoPrice * tomatoWeight)
ENDIF
IF greenBeans == 1 THEN
WRITE "Green Beans (", greenBeanWeight, "kg) : $", (greenBeanPrice * greenBeanWeight)
ENDIF
IF spinach == 1 THEN
WRITE "Spinach (", spinachWeight, "kg) : $", (spinachPrice * spinachWeight)
ENDIF
WRITE "---------------------------------------------"
WRITE "Total Cost : $", totalCost
IF discount > 0 THEN
WRITE "Discount (10%) : -$", discount
ENDIF
WRITE "Final Total Due : $", finalTotalCost
WRITE "---------------------------------------------------"
```
Note: The above pseudocode assumes that the input values for the quantities (kilos) of vegetables are valid and positive, and the user will enter only 1 or 0 for the purchase questions. Error handling for invalid inputs or edge cases is not included in this pseudocode.