47.7k views
5 votes
Ensure the file named HouseSign.cpp is 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 if statements as appropriate. The output statements are written for you.

Execute the program by clicking the Run button. Your output should be: The charge for this sign is $82.





// HouseSign.cpp - This program calculates prices for custom made signs.


#include
#include
using namespace std;
int main()
{
// This is the work done in the housekeeping() function






// Declare and initialize variables here






// Charge for this sign





// Color of characters in sign






// Number of characters in sign






// Type of wood

// This is the work done in the detailLoop() function
// Write assignment and if statements here

// This is the work done in the endOfJob() function
// Output charge for this sign
cout << "The charge for this sign is $" << charge << endl;
return(0);
}

1 Answer

5 votes

int main() { double charge = 0.00; int numChars = 8; string color = "gold"; string woodType = "oak";

charge = numChars * 5.0;

if (color == "gold") { charge += 10.0; }

if (woodType == "oak") { charge += 10.0; }

cout << "The charge for this sign is $" << charge << endl;

return 0; }

User Danilo Bustos
by
7.4k points