Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For each of the following descriptions: (i) Write a suitable type declaration (or set of type declarations) for representing the data. ii) Show how to

image text in transcribed

For each of the following descriptions: (i) Write a suitable type declaration (or set of type declarations) for representing the data. ii) Show how to dynamically allocate the necessary memory, and initialise any obvious fields Assume that all strings have an upper limit of 139 characters sible to use and manipulate all the information through a single pointer variable.) (a) A planet, consisting of a name, number of moons, and distance from the sun in kilometres (b) A set of instructions for finding buried treasure and the value of the treasure. Each instruction consists of a direction (north, south, east or west) and a distance in metres to travel Assume that there is a pre-existing variable num that indicates how many in structions there will be. (c) A recipe, consisting of a name and a collection of ingredients. Each ingredient itself has a name and an amount in kilograms (a real number). There is no upper limit on the number of ingredients, but you can assume the required number has previously been determined and stored in the int variable ingreds

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions