Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A sanitary ware shop keeps the following information for the items in stock: description (a string, for example bath) code to distinguish between items

 

A sanitary ware shop keeps the following information for the items in stock: description (a string, for example "bath") code to distinguish between items with the same description and colour but of a different design (a string to store 6 digits, for example "123456") colour (a string, for example "white") number in stock (an integer, for example 49) price (a floating point number, e.g. 349.95) (a) (b) Write down the declaration for a struct for storing the information associated with one kind of item in stock. Give the name Item to the struct. Assume that an array Item stock [50] has been declared and that information for 50 items in stock has been stored in the array. The program fragment below prints the codes for all the white baths and determines the total number of white baths in stock. Now write down ONLY the necessary C++ instructions for line numbers 2, 4, 6, 8, 9 and 11 to complete this program fragment. Write down only the line number and the instruction that should appear next to the line number. 1. int total; 2. //initialise total 3. //search through array to find all white baths 4. for () //examine all items 5. { 6. //test if item is a white bath 7. { 8. 9. 10. } 11. //display isplay use c++ to answer question //print codes for white baths //update the total number of white baths in stock total number of white baths in stock

Step by Step Solution

3.53 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

a The declaration of the struct required is struct Item char description 15 colour 10 int ... 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

Foundations of Macroeconomics

Authors: Robin Bade, Michael Parkin

6th edition

132831007, 978-0132831000

More Books

Students also viewed these Economics questions