95.4k views
2 votes
In this lab, you complete a partially prewritten C++ program that includes functions with no parameters.

The program asks the user if he or she has preregistered for tickets to an art show. 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 percent discount." If the user has not preregistered, the program should call a function named noDiscount() that displays the message, "Sorry, you did not preregister and do not qualify for a 5 percent discount."

The source code file provided for this lab includes the necessary variable declarations and the input statement. Comments are included in the file to help you write the remainder of the program.

Instructions

Ensure the source code file named ArtShowDiscount.cpp is open in the code editor.

Write the C++ statements as indicated by the comments.

Execute the program by clicking the Run button.

User Jao
by
4.3k points

1 Answer

6 votes

Answer:

// ArtShowDiscount.cpp - This program determines if an art show attendee gets a 5% discount for preregistering.

// Input: Interactive

// Output: A statement telling the user if they get a discount or no discount.

#include <iostream>

#include <string>

using namespace std;

void discount();

void noDiscount();

int main()

string registerString;

cout << .Did you preregister? Enter Y or N:

cin >> registerString;

//Completing the remaining Program

If (registerString== "Y")

{

discount();

}

else

{

noDiscount();

}

return 0;

} // End of main function

// Discount function

public void Discount()

{

cout << "You are preregistered and qualify for a 5 percent discount."

}

// noDiscount function

public void noDiscount()

{

cout << "Sorry, you did not preregister and do not qualify for a 5 percent discount."

}

Step-by-step explanation:

In the half given program, I add the the rest half in which i added-

The check condition to call the discount or nodiscount function on the basis of string input provided by the user.

The definition of discount function which call when the user is preregistered and prints the required discount message.

The definition of nodiscount function which call when the user is not preregistered and prints the required nodiscount message.

User Sanoj Kashyap
by
4.7k points