For many, Easter is a time for receiving chocolate eggs. Large ones, small ones, solid ones, hollow ones, filled ones. D

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

For many, Easter is a time for receiving chocolate eggs. Large ones, small ones, solid ones, hollow ones, filled ones. D

Post by answerhappygod »

For Many Easter Is A Time For Receiving Chocolate Eggs Large Ones Small Ones Solid Ones Hollow Ones Filled Ones D 1
For Many Easter Is A Time For Receiving Chocolate Eggs Large Ones Small Ones Solid Ones Hollow Ones Filled Ones D 1 (124.88 KiB) Viewed 10 times
For many, Easter is a time for receiving chocolate eggs. Large ones, small ones, solid ones, hollow ones, filled ones. Dark chocolate ones, milk chocolate ones, white chocolate ones. Stripy wrapped ones, spotty wrapped ones, plain wrapped ones. Chocolate eggs! How many did you get? Which did you get the most of? Which did you get the least of? The Easter Bunny has asked you to develop an app to manage my collection of Easter eggs, to analyse the data and illustrate various distributions. Eggs are characterised by their maker, and there are many around the world! All eggs of the same chocolatier should be stored in the computerised collection together for ease of access. And I'm not greedy; I'll only keep five eggs of each maker, giving the remainder to my little sister (i.e. discarding them). Each egg should have its volume in cubic centimetres (a double), weight in grams (an int), filling (an enumeration), wrapper style (an enumeration), and blend of chocolate (an enumeration) stored. The collection of eggs for each chocolatier can be stored in any order. An egg may be defined as follows: typedef enum (DARK, MILK, WHITE) chocolate; typedef enum {STRIPY, SPOTTY, PLAIN} wrapping; typedef enum (SOLID, HOLLOW, FILLED} filling; struct egg_int { double volume; int weight; chocolate choc; wrapping wrap; filling fill; }; typedef struct egg_int *egg; and you may assume the existence of those types and the following types and functions:
void init_egg (egg *e, double v, int w, chocolate c, wrapping r, filling f); double get_volume (egg e); int get_weight (egg e); chocolate get_choc (egg e); wrapping get_wrap (egg e); filling get_fill (egg e); void set_volume (egg e, double v); KIT107 Programming void set_weight (egg e, int w); void set_choc (egg e, chocolate c); void set_wrap (egg e, wrapping r); void set_fill (egg e, filling f); char *to_string (egg e); The types and variables required to implement my basket (a group of chocolatiers) and a collection (a cluster of eggs) for each chocolatier include the following: struct node_int { void *data; node next; }; typedef struct node_int *node; typedef ??? collection; typedef struct { char *name; Continued... -6-
collection eggs; } chocolatier; typedef ??? chocolatiers; chocolatiers basket; a. Which underlying data structure (array or linked-list) will you use as a basis to model the overall collection of chocolatiers (i.e. the chocolatiers type)? In two-three sentences, justify your answer. Click or tap here to enter text. [4 marks] b. Which kind of abstract data type (binary tree, general tree, array, stack, priority queue, double-ended queue, set, list, etc.) would you use to model the collection of chocolatier? In two-three sentences, justify your answer by indicating the functionality required. Click or tap here to enter text. [4 marks] C. Which underlying data structure (array or linked-list) will you use as a basis to model the collection of eggs (i.e. the collection type)? In two-three sentences, justify your answer. Click or tap here to enter text. [4 marks] d. Which kind of abstract data type (binary tree, general tree, array, stack, priority queue, double-ended queue, set, list, etc.) would you use to model the collection of eggs? In two-three sentences, justify your answer by indicating the functionality required. Click or tap here to enter text. [4 marks] Continued...
e. Given your definition for the collection of sessions in parts (a) and (c) above: i. Using typedefs, define the types collection and chocolatiers that represent a collection of eggs and chocolatiers respectively. Click or tap here to enter text. [5 marks] ii. Implement the following functions that allow the manipulation of a collection of chocolatiers given your answers above: void init_chocolatiers () - create an empty data set; Click or tap here to enter text. [5 marks] • void add_egg (egg e, char *maker) — add the egg e to basket for the named chocolatier; Click or tap here to enter text. [10 marks] print all eggs in void display_eggs (char *maker) basket for the indicated chocolatier; Click or tap here to enter text. [5 marks] • int count_wrap (int w) - count and return the total number of eggs in basket with wrapping w; and Click or tap here to enter text. [5 marks] bool full () - determine whether basket is full returning true if so and false otherwise. (It is full if there are five eggs for all known chocolatiers.) Click or tap here to enter text. [5 marks]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply