Answered step by step
Verified Expert Solution
Question
1 Approved Answer
TASKS 1. a) List two major differences between a variable that is an array and a variable that is of a structured data type. Which
TASKS 1. a) List two major differences between a variable that is an array and a variable that is of a structured data type. Which would you use to store the catalog description of a course? To store the names of students in the course? b) Define a structure according to the information provided: Structure name - studentType Structure members: . name: type char, has 50 characters . no_ID: type integer testl: type float test2: type float total: type float c) Declare the following variables: i. Jason type of studentType. ii. new_students is an array of studentType, with 5 elements. 2. a) Define a structure type SSquareColumnT to represent a square timber column. Components should include the type of wood (a string of less than 20 characters), the length and width of the column in inches, and the maximum compressive strength of the wood in whole pounds per square inch. Here is a variable sq_col that it should be possible to declare using your data type. Table 1: sq_col acType Douglas fir dLength 84.0 dWidth 6.5 iMaxCompStrength 445 b) Define a structure type inventory containing character array acPartName[30], integer iPartNumber, floating point fPrice, integer iStock, and integer iReorder. c) Define a struct called address, containing character arrays acStreetAddress[25], acCity[20], acState[3] and acZipcode[6]. d) Define a structure type cat_num_t to represent a catalog number consisting of a two- or threecharacter category code followed by an integer. Then define a structure type cat_entry_t to represent a catalog entry. Each entry has a catalog number, a description that is a string of a up to 19 characters, a wholesale price, and a retail price. e) Define two output functions for the data types you defined in Question 3.2.d: print_cat_num and print_cat_entry. Output of a catalog entry should resemble the following example. Number: EXC-412 Description: 2400 BAUD MODEM Wholesale price: $79.86 Retail price: $119.99 Enter catalog number: Enter letters before dash> Enter digits after dash> f) Define an interactive input function for catalog numbers. Name the function fnScanCatNum. The function should prompt the user as follows. Function fnScanCatNum should take a single structured output argument through which it stores the catalog number entered. Function fnScanCatNum should prompt user to enter catalog number and validate the entered catalog number to ensure it meets the format. The function should return 1 for successful input, 0 for invalid input
Step 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