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
katrin2010 [14]
3 years ago
6

A program asks the user to enter the unit price of a chair and the quantity he is buying. It calculates and displays the total p

rice. The unit price is
Computers and Technology
1 answer:
Shtirlitz [24]3 years ago
4 0

Answer:

The c++ program for the given scenario is shown below.

#include <iostream>

using namespace std;

int main() {

   // variables declared for unit price, quantity, total price

// price is taken as double

// quantity is taken as integer

   double chair_price, total_price;

   int chair_qty;

   cout << " Enter the unit price of the chair : " << endl;

   cin >> chair_price;

   cout << " Enter the number of the chairs to be bought : " << endl;

   cin >> chair_qty;

   total_price = chair_price * chair_qty;

   cout << " The total price for " << chair_qty << " chairs is " << total_price << endl;

   return 0;

}

OUTPUT

Enter the unit price of the chair  

23.4

Enter the number of the chairs to be bought  

10

The total price for 10 chairs is 234

Explanation:

 

1. The variables for unit price, quantity of chairs and total price of chairs are declared. The reason for data type is explained below.

double chair_price, total_price;

   int chair_qty;

2. The variables are not initialized since their values is to be entered by the user.

3. First, the user is prompted to enter the unit price of the chair. This is stored in a double variable since price can be in decimals.

cin >> chair_price;

4. Next, the user enters the number of chairs to be bought. This value is stored in an integer variable since quantity can not be a decimal number.

cin >> chair_qty;

5. The total price is computed as the product of the unit price and the quantity of chairs. The total cost is also stored in a double variable since unit price can be in decimals.

total_price = chair_price * chair_qty;

6. Lastly, this total price is displayed to the standard output.

7. The keyword endl is used to insert new line.

You might be interested in
The array index can be any nonnegative integer less than the array size.
suter [353]
I think the answer is true
7 0
3 years ago
IF ANYONE ANSWERS YOUR QUESTION WITH SOMETHING LIKE THIS:
vova2212 [387]

Answer:Thank you very much! A user names SShalomeea has been hacking today. Anyone with that photo is a spammer.

4 0
3 years ago
Read 2 more answers
PLEASE HELP ASAP! WILL MARK BRAINLIEST IF THE ANSWER IS CORRECT! I NEED HELP WITH THE 3RD ONE!
Bogdan [553]

Answer:

Explanation:

.1 Display all information from the customer table for all customers that have a balance that is greater than the average balance.

2. Display all information from the rep table for all representatives that have a rate which is equal to the minimum rate for representatives.

3. Display each unique description and price (no duplicates) for all parts that have a quoted price that is greater than the average quoted price for all parts ordered.

4. List all streets where either a customer or a representative is located

5 0
4 years ago
Gian wants to add audio to his presentation whichaude ves not supported
Soloha48 [4]

Answer:

TIFF file is not audio format file rather it is graphic container that stores raster images.

Explanation:

Gain can add all other audio files (MIDI, MP3, Windows media audio file) to his presentation.

What are MIDI, MP3 and WMA :

MIDI:

Musical Instrument Digital Interface (MIDI) is a protocol that is designed for recording and playback music on digital synthesizers that is supported by many computer sound cards. Gian can add MIDI audio format file in his presentation.

MP3:

This audio file format technology compress a sound technology into very small file while preserving the original quality of sound when it is played. Gian can add this audio format in presentation to play audio in presentation.

WMA

This audio format is developed by Microsoft. It contains a series of audio codecs and their corresponding audio formats.

Gian can add WMA extension audio file to his presentation to play audio.

3 0
4 years ago
Natalie enjoys talking to people and helping them with their problems. Her friends always tell her that she’s a good listener. B
Akimi4 [234]

Answer:

C and D

Explanation:

The other 3 answers don't even involve talking.

7 0
4 years ago
Read 2 more answers
Other questions:
  • Plagiarism occurs when writers
    14·2 answers
  • Samantha plans an investigation in which she will study a population of animals. Which of these answers best describes the focus
    8·1 answer
  • What does a break statement do
    6·1 answer
  • To insert text from a separate file into your Word document
    10·1 answer
  • What is one major difference between the roles of film directors and theater directors? A. A theater director is involved in sel
    14·1 answer
  • You can insert video by clicking video drop-down menu on the ______ tab.
    15·1 answer
  • Collisions occur when one output is mapped to two inputs. <br><br> A. True <br> B. False
    7·2 answers
  • I need so much help, can anyone please help me?
    15·1 answer
  • Today's manufacturing workplace is most likely to include
    8·1 answer
  • you manage a network that has multiple internal subnets. you connect a workstation to the 192.168.1.0/24 subnet. this workstatio
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!