Question
Interstellar explorers find an Earth-like planet orbiting FH-3299. Some cute, harmless creatures have evolved there. You decide to set up a petting zoo, with three
Interstellar explorers find an Earth-like planet orbiting FH-3299. Some cute, harmless creatures have evolved there. You decide to set up a petting zoo, with three types of creatures: skwilks, zambos, and drufts.
The creatures eat earthworms and paperclips. Each week:
Skwilks eat 1.8 kilos of earthworms, and 5.3 kilos of paperclips
Zambos eat 2.3 kilos of earthworms, and 6.2 kilos of paperclips
Drufts eat 3.9 kilos of earthworms, and 7.7 kilos of paperclips
A kilos of worms costs $4.52. A kilo of paperclips costs $7.55.
Write a program to compute the weekly cost of feeding your critters, given the number of each type of critter you have in the zoo. Heres a screenshot:
Round the cost to the neatest cent. Its OK to leave off the last digit if its zero. Check the rounding numbers hint; it might be useful.
All inputs should be numeric, and not less than zero. Your program should show an error message and stop when theres an error. For example:
Your program can stop immediately when it detects an error, or show all applicable error messages and then stop. Your choice.
You must use subroutines. Use three at least: input, processing, and output. You may use more if you want.
1 Petting zoo weekly food cost 3 Skwilks 4 Zambos 5 Drufts 6 12 Run 8 9 Earth worms 0 Paperclips 59.5 kilos 151.7 kilos 12 Total cost: 1414.28 13Step 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