Question

Please help, In this lab, you complete a prewritten C++ program for a carpenter who creates...

Please help,

In this lab, you 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

  1. Ensure the file named HouseSign.cppis open in the code editor.

  2. 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).
  3. Write the rest of the program using assignment statements and ifstatements as appropriate. The output statements are written for you.

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

This is the code,

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

#include <iostream>
#include <string>
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);
}   

Specail thanks in advance!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
#include <string>
using namespace std;

int main() {
//Initializing the input values
   double charge = 0.00;
   int numChars = 8;
   string color="gold";
   string woodType="oak";
   //adding minimum charge
   charge+=35;
   //adding 4 dollars for each character if there are more than total characters
   charge+=(numChars-5)*4;
   //If it has to be gold leaf lettering, adding 15 dollars
   if(!color.compare("gold")) //if color contains gold as string, then color.compare("gold") will return 0.
   charge+=15;
   //If the sign is made of oak, add 20 dollars
   if(!woodType.compare("oak")) //if woodType contains oak as string, then woodType.compare("oak") will return 0.
   charge+=20;
   cout << "The charge for this sign is $" << charge << endl;
   return 0;
}

Output:

Add a comment
Know the answer?
Add Answer to:
Please help, In this lab, you complete a prewritten C++ program for a carpenter who creates...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • unctions with No Parameters Summary In this lab, you complete a partially prewritten Python program that...

    unctions with No Parameters Summary In this lab, you complete a partially prewritten Python program that includes a function with no parameters. The program asks the user if they have preregistered for art show tickets. If the user has preregistered, the program should call a function named discount() that displays the message "You are preregistered and qualify for a 5% discount." If the user has not preregistered, the program should call a function named noDiscount() that displays the message "Sorry,...

  • In this lab, you complete a prewritten C++ program that calculates an employee’s productivity bonus and...

    In this lab, you complete a prewritten C++ program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. Bonuses are calculated based on an employee’s productivity score as shown below. A productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked. Productivity Score Bonus <=30 $50 31–69 $75 70–199 $100 >= 200 $200 Instructions Ensure the file named...

  • Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to...

    Parallel Arrays Summary In this lab, you use what you have learned about parallel arrays to complete a partially completed Java program. The program should either print the name and price for a coffee add-in from the Jumpin’ Jive coffee shop or it should print the message: "Sorry, we do not carry that.". Read the problem description carefully before you begin. The data file provided for this lab includes the necessary variable declarations and input statements. You need to write...

  • ***Please complete the code in C*** Write a program testArray.c to initialize an array by getting...

    ***Please complete the code in C*** Write a program testArray.c to initialize an array by getting user's input. Then it prints out the minimum, maximum and average of this array. The framework of testArrav.c has been given like below Sample output: Enter 6 numbers: 11 12 4 90 1-1 Min:-1 Max:90 Average:19.50 #include<stdio.h> // Write the declaration of function processArray int main) I int arrI6]i int min-0,max-0 double avg=0; * Write the statements to get user's input and initialize the...

  • please help, In this lab, you complete a C++ program with the provided data files. The program calculates the amount of...

    please help, In this lab, you complete a C++ program with the provided data files. The program calculates the amount of tax withheld from an employee’s weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee’s take- home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay. Instructions Ensure the source code file named Payroll.cpp is open in the code editor. Variables have been...

  • Swapping Values in python Summary In this lab, you complete a Python program that swaps values...

    Swapping Values in python Summary In this lab, you complete a Python program that swaps values stored in three variables and determines maximum and minimum values. The Python file provided for this lab contains the necessary input and output statements. You want to end up with the smallest value stored in the variable named first and the largest value stored in the variable named third. You need to write the statements that compare the values and swap them if appropriate....

  • PROGRAM DESCRIPTION: In this assignment, you will be creating a memory matching game in C++. In t...

    c++ PROGRAM DESCRIPTION: In this assignment, you will be creating a memory matching game in C++. In this game, the user will need to match up the pairs symbols A,B,C,D,E on a 4x4 array. For example, the array could be initialized like the following: In this case, X represents an empty slot. The goal is for the user to match the A to the A, the B to the B, etc, until all pairs are matched up to win the...

  • Using Unix/Linux Command line in terminal and C programming. (b) Write a basic C program contained...

    Using Unix/Linux Command line in terminal and C programming. (b) Write a basic C program contained in a1q4.c and perform the following tasks in your program’s main() function: (8 marks) • Declare and initialize at least one variable of these types: char, int, unsigned int, float, double and long double. When initializing your variables, ensure the constants you use are of the same type as your variable. See the “Constants” section of Topic 7 for more information. • Use printf(3)...

  • C++ assignment. Please help me to complete this code: #include <string> #include <iostream> using namespace std;...

    C++ assignment. Please help me to complete this code: #include <string> #include <iostream> using namespace std; // Write your function here //////////////// STUDENT TESTING //////////////////// int run() { cout << "Student testing" << endl; strip(); return 0; } Here is the instruction: Write a filter function named strip that removes C++ comments from input, sending the uncommented portion of the program to output. Your program should work with both single line (//) comments, and multi-line (/* */) comments. + A...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT