A sanitary ware shop keeps the following information for the items in stock: description (a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
a The declaration of the struct required is struct Item char description 15 colour 10 int ... View the full answer
Related Book For
Posted Date:
Students also viewed these economics questions
-
In February 2001, currency held by individuals and businesses was $537.1 billion; traveler's checks were $8.0 billion; checkable deposits owned by individuals and businesses were $544.9 billion;...
-
In March 2004, currency held by individuals and businesses was $666.8 billion; traveler's checks were $7.8 billion; checkable deposits owned by individuals and businesses were $651.1 billion; savings...
-
The Sale of Goods Act in each province implies certain terms into contracts of sale relating to the fitness and quality of the product. Some Canadian jurisdictions make these provisions mandatory in...
-
You deposit $12,000 annually into a life insurance fund for the next 10 years, at which time you plan to retire. Instead of a lump sum, you wish to receive annuities for the next 20 years. What is...
-
A thermoelectric refrigerator is powered by a 12-V car battery that draws 3 A of current when running. The refrigerator resembles a small ice chest and is claimed to cool nine canned drinks, 0.350-L...
-
The catch block that begins catch(Exception e) can catch Exceptions _________________. a. Of type IOException b. Of type ArithmeticException c. For both IOExceptions and ArithmeticExceptions d. For...
-
To the left of z = 0.26 Find the indicated area under the standard normal curve. If convenient, use technology to find the area.
-
Scott Bennett is preparing his balance sheet and income and expense statement for the year ending June 30, 2016. He is having difficulty classifying six items and asks for your help. Which, if any,...
-
A company is considering two mutually exclusive projects. The projected cash flows are as follows: Cash Flows:A Cash Flows:B Year 0 -$245,000 -$250,000 1 $70,500 $60,000 2 $85,000 $60,000 3 $90,000...
-
Robert Brown applied for admission to the University of Kansas School of Law. Brown answered "no" to questions on the application asking if he had a criminal history and acknowledged that a false...
-
Four forces are exerted on the eyebolt as shown. If the net effect on the bolt is a direct pull of 600 lb in the y-direction, determine the necessary values of T and
-
Give some examples of actions that would probably fall within the conduct proscribed by (a) extortion and (b) vandalism or malicious mischief statutes.
-
What alternatives to the exclusionary rule might be adopted to enforce the protections of the Fourth Amendment? How effective are such alternatives likely to be?
-
If college sports are a public good, what can you say about the amount of it a university will supply? What can the universitys administration do to resolve this problem?
-
Should the offense of forgery be divided into degrees based on the importance of the forged documents? If so, what criteria would you propose for the various degrees of the crime?
-
What is the rationale for excluding from trial evidence obtained in violation of the Fourth Amendment? Is this a compelling justification for the exclusion of criminal evidence from the trial of a...
-
Hiram's Lakeside is a popular restaurant located on Lake Washington in Seattle. The owner of the restaurant has been trying to better understand costs at the restaurant and has hired a student intern...
-
In the busy port of Chennai, India, the number of containers loaded onto ships during a 15-week period is as follows: 1. Develop a linear trend equation to forecast container loadings. 2. Using the...
-
Suppose that at the end of December 2005, the monetary base in Canada is $60 billion, Bank of Canada notes are $55 billion, and there is $2 billion of coins. What are the reserves of the Canadian...
-
Determine whether the following changes in the demand for loanable funds and the supply of loanable funds will raise the real interest rate, lower the real interest rate, leave the real interest rate...
-
Suppose a technological advance lowers the cost of producing computer memory chips. What is the effect of this change on the demand for memory chips, the supply of memory chips, the equilibrium price...
-
A prototype can be ___________. (a) Complete system with partial requirements (b) Working model (c) Full-fledged system (d) All of these
-
_____________ is also used as requirement finding and feasibility testing tool. (a) Prototype (b) Reports (c) System (d) Procedure
-
Which of the following systems development approach is adopted if information requirements are not well defined? (a) SDLC (b) Prototype (c) Structured approach (d) Agile
Study smarter with the SolutionInn App