You are on page 1of 4

ASSIGNMENT 3 (UNIVERSITY)

Arrays, Counting Loops, and Constants

Create a project called Zoo Manager.

Manager

CREATE THE ARRAYS TO STORE THE ZOO ANIMALS INFORMATION


The starting size of these arrays will be 5. Choose 5 different animals that the zoo will have. Use constants for the types of animals. These names will go in an array. You will need 5 constants. Create a parallel array to store the price of each of the animals. The prices can be whole or decimal numbers. Set the default price for each of the animals in constants. You will need 5 constants one for each default price. Create a parallel array to store the upkeep cost of each of the animals. The prices can be whole or decimal numbers. Set the default upkeep cost for each of the animals in constants. You will need 5 constants one for each default price. Create a parallel array to store the quantity of each of the animals. The quantity must be a whole number. The quantity of each animal will start at 0. Create another parallel array that will store the entertainment value of each of the animals. The entertainment value is a decimal number. Set the default entertainment value for each of the animals in constants.

MENU SYSTEM
1) Create a menu in a conditional loop that will repeatedly print out and allow the following options: 1 - Display All Animal Types 2 Find Largest Animal Population 3 Count All Animals in Zoo 4 Purchase New Animal

5 Sell Animal Enter nothing to End Turn. Show the amount of money the user has. The starting value is 100000. 10 - Log-off (this will close the program by exiting the loop. Do not use Application.Exit() or any other similar subprogram.) The user should only have to type in the number to select each of the above options.

DISPLAY ALL ANIMAL TYPES


Display an up-to-date list of every type of animal in the zoo. In addition, for each animal type display the price, quantity, and entertainment value.

FIND LARGEST ANIMAL POPULATION


Search through all the animal quantities, and find the largest one. Show the animals type, price, quantity, and entertainment value.

COUNT ALL ANIMALS IN ZOO


Count up the total quantity of animals in the Zoo and display the results.

PURCHASE NEW ANIMAL


Allow new animals to be purchased. The user inputs are the animal type and the quantity to be purchased as. If the user inputs an animal type that already exists in your animal types array, then add the quantity to the array IF they have enough money. If the user inputs an animal type that DOES NOT already exist in your animal types array, then expand your array, and then add the animal to the arrays. To add the animal to the arrays, you will need to ask for additional information like the price, cost of upkeep, and entertainment value.

SELL ANIMAL
Allow animals to be sold. The user inputs are the animal type and the quantity to be sold. If the user inputs an animal type that does not exist in your arrays, OR the quantity to be sold is more than the quantity they have, do not all them to sell. If the information is valid, reduce the quantity element for the animal type they sold. You do not need to remove the animal from the array if the quantity is 0.

END TURN
When the user does not enter anything, it ends the turn. At the end of the turn, the program will Calculate total upkeep cost of all animals. This is subtracted from the users money. Calculate the revenue for the zoo. This is a calculation as follows: 1) The revenue that the first animal of each type generates is worth its entertainment value * 10.

2) The revenue that the second animals of each type generates is worth its entertainment value * 5. 3) The revenue created by the 3 animal is its entertainment value. 4) The revenue created by the 4th and greater animals is 1. Add the revenue to the users money.

For your solution, you: MAY use either the Console Project OR a Windows Form Project. MUST use arrays, counting loops, and constants.

Marking Scheme
Application: Weight 8. This section is out of 50 marks. Creating and Using Arrays and Constants Used a constant for the default size Correct data types Display All Animal Types Can iterate (go through) arrays/parallel arrays Counting loop goes through all elements in the array Find Largest Animal Population Count All Animals in the Zoo Can create search algorithm to find parallel array items Can apply knowledge of parallel arrays to modify a secondary set of parallel arrays Purchase New Animals Can do array search Can do array resize Can modify existing array Sell Animal Can do array search Can modify array End of Turn Can do array search Can perform array calculations Communication: Weight 8. This section is marked by level. Mark Arrays correctly named Out of Arrays commented 100 Array comments are detailed Counting loops commented Counting loop comments are detailed Header appropriate Variables correctly named Program is correctly indented Conditional loops commented Selection statements commented Equations/calculations are commented Non-trivial code (anything complicated; not just an input or output) is commented Useful prompts for any inputs and outputs Thinking: Weight 3. This section is marked by level. Testing plan: Thoroughly tests a variety of cases in each part of the program o Menu White Box o Find Largest Animal Population - Black Box o Display All Animals Black Box o Purchase New Animals Black Box o Sell Animal Black Box o End of Turn White Box Tests boundary cases Tests regular cases Mark Out of 100 Comments Marks Out of 5 Comments

Out of 5

Out 10

of

Out 15

of

Out of 5

Out 10

of

Comments

You might also like