Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Mark Daniels is a carpenter who creates personalized house signs. He wants an ap

ID: 3858267 • Letter: M

Question

Mark Daniels is a carpenter who creates personalized house signs. He wants an application to compute the price of any sign a customer orders, based on the following factors: The minimum charge for all signs is $30. If the sign is made of oak, add $15. No charge is added for pine. The first six letters or numbers are included in the minimum charge; there is a $3 charge for each additional character. Black or white characters are included in the minimum charge; there is an additional $12 charge for gold-leaf lettering. Design a flowchart and pseudocode for the following: a. A program that accepts data for an order number, customer name, wood type, number of characters, and color of characters. Display all the entered data and the final price for the sign. b. A program that continuously accepts sign order data and displays all the relevant information for oak signs with five white letters. c. A program that continuously accepts sign order data and displays all the relevant information for pine signs with gold-leaf lettering and more than 10 characters.

Explanation / Answer

C++ Program:

/* C++ Program that reads and compute the price of any sign a customer orders, based on some of factors */

#include <iomanip>
#include <iostream>
#include <string>

using namespace std;

//Function that reads type of wood
string getWoodenType()
{
int ch;

//Loop till user enters correct wood type
do
{
//Display available wood types
cout<<" Select Wood Type: 1 - Oak 2 - Pine Your Choice: ";
cin>>ch;

if(ch == 1)
return "Oak";
else if(ch == 2)
return "Pine";
else
cout<<" Incorrect choice... ";
}while(ch!=1 || ch!=2);
}

//Function that reads number of characters
int getNoOfCharacters()
{
int noCharacters;

//Reading number of characters
cout << " Enter number of characters: ";
cin >> noCharacters;

return noCharacters;
}

//Function that reads character color
string getCharactersColor()
{
int ch;

do
{
//Display available colors
cout<<" Select Color of characters: 1 - Gold Leaf 2 - Black & White Your Choice: ";
cin>>ch;

if(ch == 1)
return "Gold Leaf";
else if(ch == 2)
return "Black White";
else
cout<<" Incorrect choice... ";
}while(ch!=1 || ch!=2);
}

//Main function
int main()
{
double minCharge = 30, woodCharge, charactersCharge, colorCharge, totalCharge;
int noOfCharacters;
string customerName, woodType, charactersColor;

//Reading customer name
cout<<" Customer Name: ";
getline(cin, customerName);

//Get wood type
woodType = getWoodenType();

//Calculating wood charge based on its type
if(strcmp(woodType.c_str(),"Oak")==0)
woodCharge = 15;
else
woodCharge = 0;

//Getting number of characters
noOfCharacters = getNoOfCharacters();

//Calculating charge based on number of characters
if(noOfCharacters <= 6)
charactersCharge = 0;
else
charactersCharge = (noOfCharacters - 6) * 3;

//Getting color of character
charactersColor = getCharactersColor();

//Calculating color charge based on color
if(strcmp(charactersColor.c_str(),"Gold Leaf")==0)
colorCharge = 12;
else
colorCharge = 0;

//Calculating total charge
totalCharge = minCharge + woodCharge + charactersCharge + colorCharge;

//Displaying output
cout<< setw(-30) <<" Customer Name: " << setw(25) << customerName;
cout<< setw(-30) <<" Wood Type: " << setw(25) << woodType;
cout<< setw(-30) <<" Number of Characters: " << setw(15) << noOfCharacters;
cout<< setw(-30) <<" Color of Characters: " << setw(20) << charactersColor;
cout<< setw(-30) <<" Total Charge: " << setw(20) << " $" << totalCharge;

cout << " ";
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote