Consider the following C program code snippet that is used to compute the cost of a product based on various characteristics. char option = 'A'; char features = 'G'; int cost = 0; switch(option) {     case 'A': cost = cost + 400;     case 'M':         cost = cost + 2000;         switch(features)         {             case 'P': cost = cost + 300;             case 'B': cost = cost + 200;                       break;             default:                       cost = cost + 100;         }         break;     case 'B': cost = cost + 100;               break;          default: cost = 0;          } // Value of cost? What is the final value of the cost variable? Please type your response as an integer number without spaces, quotations, decimals, etc.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 9PP: (Data processing) Your professor has asked you to write a C++ program that determines grades at the...
icon
Related questions
Question

Consider the following C program code snippet that is used to compute the cost of a product based on various characteristics.


char option = 'A';
char features = 'G';
int cost = 0;

switch(option)
{
    case 'A': cost = cost + 400;

    case 'M':
        cost = cost + 2000;
        switch(features)
        {
            case 'P': cost = cost + 300;
            case 'B': cost = cost + 200;
                      break;
            default:
                      cost = cost + 100;
        }
        break;

    case 'B': cost = cost + 100;
              break;
    
    default: cost = 0;
        
}


// Value of cost?

What is the final value of the cost variable?
Please type your response as an integer number without spaces, quotations, decimals, etc.

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr