1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MrRa [10]
3 years ago
14

n this lab, you complete a partially prewritten C++ program that includes functions with no parameters. The program asks the use

r 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."
Computers and Technology
1 answer:
Rama09 [41]3 years ago
5 0

Answer: The c++ program given below shows the usage of functions without parameters.

#include <iostream>

using namespace std;

// functions are declared

void discount();

void noDiscount();

int main() {  

char reply;  

cout<<"Welcome " <<endl;

cout<<"Enter y if you have preregistered for tickets to an art show. Enter n if you have not preregistered for tickets to an art show. "<<endl;

cin>>reply;  

if(reply == 'y')

// function is called

    discount();      

else

// function is called

    noDiscount();  

}

// functions are defined

void discount()

{

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

}

void noDiscount()

{

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

}

Explanation:

Functions without parameters are used in the above program to display the message.

First, functions are declared with void keyword since they do not return any value. Also, no parameters are passed into the functions.

void discount();

void noDiscount();

Function or method declaration is done before main mandatorily.

These functions can be defined anywhere, before or after main. The function definition contains message to display within scope of the function, i.e., {}.

void discount()

{

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

}

Next, a character variable is declared. This variable holds the input from the user.

The user is asked to input the response either using y or n. Therefore, character variable is taken instead of a string variable.

Based on the input from the user, the required function is called. The function is called simply by using the function name followed by semi-colon.

discount();

Function declaration, definition and when the function is called, no parameters are passed or mentioned.

The above program does not implements any class since it is not mentioned in the question.

Also, the original partial program was not available for modification hence, this program has been done based on the requirements.

You might be interested in
What does Technology mean to you?​
brilliants [131]
Technology is the collection of techniques, skills, methods and processes used in the production of goods or services or in the accomplishment of objectives, such as scientific investigation. Technology can be the knowledge of techniques, processes, etc. or it can be embedded in machines, computers, devices and factories, which can be operated by individuals without detailed knowledge of the workings of such things.
8 0
3 years ago
Read 2 more answers
When you are driving on a rural road, if your right wheels run off the pavement, you should hold the steering wheel firmly and?
Lady_Fox [76]

When you are driving on a rural road, if your right wheels run off the pavement, you should hold the steering wheel firmly and such that it ought to be still with the bearing heading straight ahead and afterward while driving, it is ideal to back it off.    

Further Explanation:  

Rural Driving:  

Despite the fact that there is less traffic in rural zones those streets stay as hazardous as jam-packed thruways. There are some potential perils in country territories that you ought to know about: plain field and homestead garages and passages, animals crossing regions and ranch vehicles, harsh street conditions.  

Rural street:  

Rural streets are characterized as low traffic volume streets situated in forested and rangeland settings that serve private, recreational and asset the board employments. They may have been developed to moderately low measures with a restricted spending plan.  

Rural streets risky:

They additionally figure they can speed since, what are the chances of getting captured on a provincial street. Perilous Conditions – Because rustic streets are just two paths, it is risky to pass, the streets are typically smaller, and there is an expanded hazard for crashes that are head-on.  

Risky kind of street:  

Answer: Most individuals expect, on account of the high speeds included, that interstates or expressways are the most hazardous sort of street however they aren't. The most risky sort of streets for all drivers however particularly for youngsters are two-path nation or rustic streets  

Subject: Computers and technology

Level: High School

Keywords: Rural Driving, Rural street, Rural streets risky, Risky kind of street.

Related links:

Learn more about evolution on

brainly.com/question/2274303

brainly.com/question/10827308

8 0
4 years ago
Read 2 more answers
Which is the most important reason you should properly cite information that you obtain from an Internet search? Question 2 opti
Pepsi [2]
It is to avoid plagiarizing someone else's work
3 0
4 years ago
Select the two true statements about functions with parameters:
kondor19780726 [428]

Answer:

Option (B) and (C) is the correct option to the following question.

Explanation:

Because the function is the module of the program and we call that function again and again anywhere whenever we need that function in the program.

Function is used to carry out any operation which is used in the program many times and it creates the program short and simple.

<u>For example</u>: if we need to add or multiply two numbers many times in the program then, we create one or two functions for addition and subtraction or one program for both, when we need them we call them.

4 0
3 years ago
What is the rotation used for the picture in Fig 17
mihalych1998 [28]

Answer:

hi, where is the picture

8 0
2 years ago
Other questions:
  • What is going to be the shortest, most concise restatement of information?
    10·2 answers
  • The concept of vertical farming allows agriculture to occur when there is not enough___Available .
    13·1 answer
  • Which of the following is NOT true about RMI? RMI uses the socket connection, including opening and closing the socket. RMI allo
    8·1 answer
  • Design two subclasses of Employee…SalariedEmployee and HourlyEmployee. A salaried employee has an annual salary attribute. An ho
    12·1 answer
  • Are storage devices input devices
    8·1 answer
  • ________________are programs that designed to help users to be more productive with their personal tasks
    11·2 answers
  • Each computer on a network requires a unique way to identify itself and to refer to other computers. This is accomplished by usi
    8·1 answer
  • Transborder data flow (TDF) restricts the type of data that can be captured and transmitted in foreign countries. True or False
    12·1 answer
  • Indicate if the statement is true or false False 1. A spreadsheet cannot recalculate after you have changed data in your workshe
    15·1 answer
  • What is 11x12x12x14x15x16
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!