A programmer needs to write a program using switch statement that will examine the value of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A programmer needs to write a program using switch statement that will examine the value of an integer variable called code and print one of the following messages, depending on the value assigned to code: . . OFF, if code has a value of 0 ON, if code has a value of 1 START, if code has value of 2 FAIL if code has any other value 1. Design an algorithm using flowchart for the above problem. 2. Modify the flowchart so the program can check for any number of code(s). [5 marks] [5 marks] [5 marks] 3. Write an equivalent C program for the flowchart in Q2. 4. Change the switch structure in flowchart Q2 to an if..else structure and write an equivalent [5 marks] pseudocode. 5. Compare the algorithm in Q2 and Q4 in terms of: a. Logic built in these algorithms. [1 mark] b. Simplicity/brevity in designing the algorithm. [1 mark] c. Suitability of the structures (switch vs. if..else) for this problem. Reason your selection. [3 marks] A programmer needs to write a program using switch statement that will examine the value of an integer variable called code and print one of the following messages, depending on the value assigned to code: . . OFF, if code has a value of 0 ON, if code has a value of 1 START, if code has value of 2 FAIL if code has any other value 1. Design an algorithm using flowchart for the above problem. 2. Modify the flowchart so the program can check for any number of code(s). [5 marks] [5 marks] [5 marks] 3. Write an equivalent C program for the flowchart in Q2. 4. Change the switch structure in flowchart Q2 to an if..else structure and write an equivalent [5 marks] pseudocode. 5. Compare the algorithm in Q2 and Q4 in terms of: a. Logic built in these algorithms. [1 mark] b. Simplicity/brevity in designing the algorithm. [1 mark] c. Suitability of the structures (switch vs. if..else) for this problem. Reason your selection. [3 marks]
Expert Answer:
Answer rating: 100% (QA)
Unfortunately Im unable to directly create visual content like flowcharts However I can help by describing what you would do to create the flowchart a... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Alexas Corporation reports the following: Earnings per share Dividends per share Book value per share - at end of the year Analysts' expected earnings for Alexas for next two years are: 2016: $2.00...
-
1.The _________ , also known as the address operator, returnsthe memory address of a variable. a. asterisk ( * ) b. ampersand (& ) c. percent sign ( % ) d. exclamation point ( ! ) 2. With pointer...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
In January, the Cabinet Company worked on six job orders for specialty kitchen cabinets. It began job A-62 are as follows: The Cabinet Company produced a total of 34 cabinets for job A-62. Its...
-
Heat Publishing Ltd. completed the following transactions during 2013 and 2014. 2013 Dec. 6 Purchased 1,000 shares of Georgian Graphics Inc. at a price of $41.00 per share, intending to sell the...
-
Using the data from Data Set I in Appendix B, make a stem and leaf plot for the record low temperatures in the United States. Describe the nature of the plot. Data from Set I Appendix B Data Set I...
-
The trial balance for Gold Rush Exploration Company, Inc. does not balance. The following errors were detected: a. The cash, balance is overstated by \($2,000\). b. Rent expense of \($390\) was...
-
Terrys Concrete acquired 20% of the outstanding common stock of Blakeley, Inc. on January 1, 2010, by paying $1,100,000 for 40,000 shares. Blakeley declared and paid a $0.50 per share cash dividend...
-
1. Define corporate governance & list 4 rights of shareholders. 2. Define 'Corporate Social Responsibility' (CSR). What are the four types of CSR? 3. Describe and explain the relationship between...
-
VF Corporation is an apparel company that owns recognizable brands like Timberland, Vans, Reef, and 7 For All Mankind. Exhibit 5.18 and 5.19 present balance sheets and income statements,...
-
When I worked at the oil & gas company, we had a check for $250,000 for compressor rentals that were stolen and the payee's name changed. The check was initially payable to a compressor company...
-
Your firm is considering a $120 million investment to launch a new product line. The project is expected to generate a free cash flow of $20 million per year, and its unlevered cost of capital is 8%....
-
If it is managed efficiently, Remel, Inc., will have assets with a market value of $49.5 million, $101.4 million, or $148.8 million next year, with each outcome being equally likely. However,...
-
Bond value and interest rate risk For each pair of bonds say which one has more interest rate risk and why it has more interest rate risk. a. Bond A has a 5% annual coupon, 20-year maturity, and is...
-
We R Toys (WRT) is considering expanding into new geographic markets. The expansion will have the same business risk as WRTs existing assets. The expansion will require an initial investment of $45...
-
You are a U.S. investor who is trying to calculate the present value of a ;14 million cash inflow that will occur one year in the future. The spot exchange rate is S = $1.137/; and the forward rate...
-
19. The lymphatic system is composed of all of the following except A) lymphatic vessels. B) lymph nodes C) the spleen. D) the vena cavae E) lymph. 20. The lymphocytes are most important in A)...
-
An item of depreciable machinery was acquired on 1 July 2009 for $120,000 by cash It is expected to have a useful life of 10 years and zero salvage value On 1 July 2012, it was decided to revalue the...
-
Write code statements to create a DecimalFormat object that will round a formatted value to 4 decimal places. Then write a statement that uses that object to print the value of result, properly...
-
How many line segments are used to construct a Koch snowflake of order N? Produce a chart showing the number of line segments that make up a Koch snowflake for orders 1 through 9.
-
If a picture is made up of 128 possible colors, how many bits would be needed to store each pixel of the picture? Why?
-
You have been approached by promoters to give an opinion on the financial statements to be included in the prospectus of a proposed corporation to be named U-Park Corporation. U-Park will own and...
-
The following questions relate to the auditor's responsibility for reporting on inconsistency of application of accounting principles. Select the best response. a. Raider uses the last-in, first-out...
-
J.O. Cole, a sole proprietor, operates a trucking business. Cole also has assets and liabilities in connection with other activities. You are retained to audit the accounts of the J.O.C. Truck Lines...
Study smarter with the SolutionInn App