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

Create a C++ Code to represent the logic of your program that: Asks the user how

ID: 3833882 • Letter: C

Question

Create a C++ Code to represent the logic of your program that:

Asks the user how many Darth Vader Check Print Silk Ties they want to buy.
Each Darth Vader Check Print Silk Tie costs the user $64.99.

Calculate how much the user will spend.
If the user spends over $200.00, they are a big spender. You will set the value of a character variable to indicate whether they are a big spender or not.

Display a message stating how much the user spent and if they are a big spender or not. Evaluate the value of your “big spender” variable to decide which message you will display.

You do not need to have any modules other than the main module in your program.

Your program will have variables to hold the following information:

quantity of Darth Vader Check Print Silk Ties user wants to buy

total amount user spends on Darth Vader Check Print Silk Ties

whether they are a big spender or not (Y = yes, N = no)

Your program will have a named constant to hold the following information:

cost of each Darth Vader Check Print Silk Tie

THIS IS THE PSEUDOCODE I HAVE

Main module()

            Declare int numTies

            Constant int perTie = 64.99

            Display “How many Darth Vader Check Print Silk Ties do you want to buy?”

            Input numTies

            totalCost = numTies * perTie

            If totalCost >= 200

                        bigSpender = ‘Y’

            Else if total cost < 200

                        bigSpender = ‘N’

            End if

           

            If bigSpender == ‘Y’

                        Display “User is a big spender and spent totalCost”

            Else if bigSpender ==’N’

                        Display “User is not a big spender and spent totalCost”

            End if

End module

Explanation / Answer

Here is your c++ program

#include<iostream>
using namespace std;

int main() {
   const float price_per_tie = 64.99; //named constant to hold price per tie
   int numOfTies; // variable to hold number of ties to be bought by buyer
   float totalCost; // variable to hold the total Spend by customer
  
   cout<<"How many Darth Vader Check Print Silk Ties do you want to buy?"<<endl;
   cin>>numOfTies; // saving input in variable
  
   totalCost = numOfTies*price_per_tie; // calculating totalCost
   char bigSpender;
  
   if(totalCost >= 200) { // if totalCost is more than 200 , then customer is bigspender else not
       bigSpender = 'Y';
   } else {
       bigSpender = 'N';
   }
  
   if(bigSpender == 'Y') {//printing the details of the bigspender
       cout<<"User is a big spender and spent:"<<totalCost<<endl;
   } else {
       cout<<"User is not a big spender and spent:"<<totalCost<<endl;
   }
   return 0;
}

Sample run: -

How many Darth Vader Check Print Silk Ties do you want to buy?
3
User is not a big spender and spent:194.97

--------------------------------
Process exited after 4.527 seconds with return value 0
Press any key to continue . . .

How many Darth Vader Check Print Silk Ties do you want to buy?
6
User is a big spender and spent:389.94

--------------------------------
Process exited after 3.944 seconds with return value 0
Press any key to continue . . .