Wolmer’s Trust High School for Girls

CAPE COMPUTER SCIENCE

 

Upper and Lower Sixth                                Teacher:  Mrs. McCallum-Rodney

 

CLASSWORK AND DISCUSSION ON STRUCTURES

 

1.      Declare the following structures:

 

a.       A Student structure, consisting of the student’s name, student number, year enrolled, GPA, and whether or not the student has graduated. Define a variable (also called – object) called Fred to access the Student structure.

 

Allow the user to enter the information required for Fred.

 

Create another object (global) called fulltime, to hold data on 50 students.  Write a function to fill the record of each student.

 

b.      An Automobile structure, consisting of the automobile year, colour (blue, black, yellow, red, or green), and price.  Make provision to use this structure for a Ford, Chevy, or Dodge.

 

c.       A Weather structure, consisting of the date, temperature, barometric pressure, and conditions.  Assume that there are three reportable conditions:  clear, cloudy, and rainy.  Make provision to use this structure for storing morning, afternoon, evening, and night weather information.

 

2.      Design and implement a structure to hold data about vehicle parts and prices.  There should be at least three structure members:  part number, part name, and the part’s price.  Create two objects of the structure, one for 5 cars (global object) and the other for 2 vans (local object). 

 

Write a function for each of the following:

 

a.       Fill the member of the objects for each car and van.

 

b.      Display what is in each object’s members.

 

Make a Free Website with Yola.