answer.
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
Effectus [21]
2 years ago
3

In this lab, you complete a partially prewritten C++ program that includes functions with no parameters.

Computers and Technology
1 answer:
scZoUnD [109]2 years ago
6 0

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."

}

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.

You might be interested in
How can we make our programs behave differently each time they are run?
tensa zangetsu [6.8K]

Answer:

By given the right speech as much as the answers must be

Explanation:

By given the right speech as much as the answers must be

7 0
1 year ago
In the simulation, player 2 will always play according to the same strategy. The number of coins player 2 spends is based on wha
baherus [9]

The simulation, player 2 will always play according to the same strategy.

Method getPlayer2Move below is completed by assigning the correct value to result to be returned.

Explanation:

  • You will write method getPlayer2Move, which returns the number of coins that player 2 will spend in a given round of the game. In the first round of the game, the parameter round has the value 1, in the second round of the game, it has the value 2, and so on.

#include <bits/stdc++.h>  

using namespace std;

bool getplayer2move(int x, int y, int n)  

{

   int dp[n + 1];  

   dp[0] = false;  

   dp[1] = true;  

   for (int i = 2; i <= n; i++) {  

       if (i - 1 >= 0 and !dp[i - 1])  

           dp[i] = true;  

       else if (i - x >= 0 and !dp[i - x])  

           dp[i] = true;  

       else if (i - y >= 0 and !dp[i - y])  

           dp[i] = true;  

       else

           dp[i] = false;  

   }  

   return dp[n];  

}  

int main()  

{  

   int x = 3, y = 4, n = 5;  

   if (findWinner(x, y, n))  

       cout << 'A';  

   else

       cout << 'B';  

   return 0;  

}

8 0
2 years ago
Jim is writing a program to calculate the wages of workers in a teddy bear factory.
34kurt

Answer:

The algorithm is as follows;

1. Start

2. Input TeddyBears

3. Input Hours

4. WagebyTeddy = 2 * TeddyBears

5. WagebyHour = 5 * Hours

6. If WagebyHour > WagebyTeddy then

6.1 Print WagebyHour

7. Else

7.1. Print WagebyTeddy

8. Stop

Explanation:

The following variables are used;

TeddyBears -> Number of teddy bears made

Hours -> Number of Hours worked

WagebyTeddy -> Wages for the number of teddy bears made

WagebyHour -> Wages for the number of hours worked

The algorithm starts by accepting input for the number of teddy bears and hours worked from the user on line 2 and line 3

The wages for the number of teddy bears made  is calculated on line 4

The wages for the number of hours worked  is calculated on line 5

Line 6 checks if wages for the number of hours is greated than wages for the number of bears made;

If yes, the calculated wages by hour is displayed

Otherwise

the calculated wages by teddy bears made is displayed

3 0
2 years ago
Form the recurrence relations (RRs) for the number of vertices and the number of edges of a hypercube of n dimensions, Hn. Solve
Rus_ich [418]
I'll write it below Step-by-step explanation: Q1 a side that has 10 sides and 10 angles is called decagon. Q2 it is nonagon Q3 it is Pentagon Q4it is heptagon
8 0
2 years ago
Assume that a gallon of paint covers about 350 square feet of wall space. Create an application with a main() method that prompt
Makovka662 [10]

Answer:

<em>C++</em>

#include <iostream>

#include <cmath>

using namespace std;

///////////////////////////////////////////////////////////////////////

int noOfGallons(int wallArea) {

   int gallon = 350;

   int gallon_price = 32.0;

   float total_price = 0.0;

   ///////////////////////////////////////////

   float noOfGallons = (float)wallArea/(float)gallon;

   printf("No of gallons needed %.2f", noOfGallons);

   cout<<endl;

   //////////////////////////////////////////

  total_price = noOfGallons*gallon_price;

   return round(total_price);

}

int wallArea(int length, int width, int height) {

   int wall_area = length*width;

   int total_price = noOfGallons(wall_area);

}

///////////////////////////////////////////////////////////////////////

int main() {

   int length, width, height;

   ///////////////////////////////////////////

   cout<<"Enter length: ";

   cin>>length;

   

   cout<<"Enter width: ";

   cin>>width;

   

   cout<<"Enter height: ";

   cin>>height;

   

   cout<<endl;

   ///////////////////////////////////////////

   int total_price = wallArea(length, width, height);

  cout<<"Total price: $"<<total_price;

   ///////////////////////////////////////////

   return 0;

}

5 0
2 years ago
Other questions:
  • Splunk uses ________ to categorize the type of data being indexed..
    11·2 answers
  • Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; th
    8·2 answers
  • The Windows ________ is a hierarchical database that stores system configuration information. It maintains files used to control
    15·1 answer
  • _____ is a markup language designed to transport and store data on the Web. Group of answer choices Standard Generalized Markup
    13·1 answer
  • Consider the following 3-PARTITION problem. Given integers a1; : : : ; an, we want to determine whether it is possible to partit
    10·1 answer
  • How many solutions exist for the given equation?
    9·1 answer
  • What are some reasons DNS is necessary? Check all that apply. A. It maps local addresses to simple names without editing hosts f
    7·1 answer
  • George is working with an image in Photoshop. He added a lot of effects to the image. He saved the first draft of the file. The
    6·2 answers
  • Select the correct text in the passage.
    11·1 answer
  • You know that you should check the room for security against unwanted entry do you check locks on doors and windows. What else d
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!