Complete a prewritten C++ program for a carpenter who creates personalized house signs. The program is supposed to compute the price of any sign a customer orders, based on the following facts:

The charge for all signs is a minimum of $35.00.
The first five letters or numbers are included in the minimum charge; there is a $4 charge for each additional character.
If the sign is made of oak, add $20.00. No charge is added for pine.
Black or white characters are included in the minimum charge; there is an additional $15 charge for gold-leaf lettering.

Instructions:

Ensure the file named HouseSign.cppis open in the code editor. You need to declare variables for the following, and initialize them where specified:

A variable for the cost of the sign initialized to 0.00 (charge).
A variable for the number of characters initialized to 8 (numChars).
A variable for the color of the characters initialized to "gold" (color).
A variable for the wood type initialized to "oak" (woodType).
Write the rest of the program using assignment statements and ifstatements as appropriate. The output statements are written for you.

Respuesta :

Answer:

#include <iostream>

#include <string>

using namespace std;

int main()

{

   double charge = 0.00;

   int numChars = 8;

   string color = "gold";

   string woodType = "oak";

   

   if(numChars > 5){

       charge += (numChars - 5) * 4;

   }

   if(woodType == "oak"){

       charge += 20;

   }

   if(color == "gold"){

       charge += 15;

   }

   charge += 35;

   

   cout << "The charge is: $" << charge << endl;

   return 0;

}

Explanation:

Include the string library

Initialize the variables as specified

Check if the number of characters is greater than 5 or not. If it is, add 4 to the charge for each character that is greater than 5

Check if the sign is made of oak or not. If it is, add 20 to the charge

Check if the color is gold or not. If it is, add 35 to the charge

Add the minimum cost to the charge

Print the charge

In this exercise we have to use the knowledge of the C++ language to write the code, so we have to:

The code is in the attached photo.

So to make it easier the code can be found at:

#include <iostream>

#include <string>

using namespace std;

int main()

{

  double charge = 0.00;

  int numChars = 8;

  string color = "gold";

  string woodType = "oak";

  if(numChars > 5){

      charge += (numChars - 5) * 4;

  }

  if(woodType == "oak"){

      charge += 20;

  }

  if(color == "gold"){

      charge += 15;

  }

  charge += 35;

  cout << "The charge is: $" << charge << endl;

  return 0;

}

See more about C++ at brainly.com/question/26104476

Ver imagen lhmarianateixeira