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
AleksandrR [38]
3 years ago
6

Write a program that asks for the number of units sold and computes the total cost of the purchase. Input validation: Make sure

the number of units is greater than 0. Use output (stream) manipulators: 2 digits after the decimal point g
Computers and Technology
1 answer:
stich3 [128]3 years ago
8 0

Answer:

Explanation:

The following code is written in C++, it asks the user for input on number of units sold and places it in a variable called units_sold. Then it asks for the package price and places that value in a variable called package_price. Finally it multiplies both values together into a variable called final_price and adjusts the decimals.

#include <iostream>

#include <iomanip>

using namespace std;

       int main()

       {

       // Variables

       int units_sold,

       final_price;

       // ask user for number of units sold

       cout << "\nEnter number of units sold: ";

       cin >> units_sold;

       

       //ask for Package price

       cout << "\nEnter Package Price: ";

       cin >> package_price;

       // Total amount before discount

       final_price = units_sold * package_price;

       cout << setprecision(2) << fixed;

       cout << endl;

       return 0;

       }

You might be interested in
Your new client's AdWords account has one campaign with one ad group that contains a list of hundreds of keywords. Which best pr
Degger [83]
<span>Create new ad groups with related keywords grouped together</span>
8 0
3 years ago
A student should always read the directions to a test or question so they know what is expected of them when answering the quest
Kay [80]

I don't know why you needed to ask this but the answer is True

7 0
3 years ago
Read 2 more answers
Which of the following may present a problem for Linux users?
motikmotik
Tendancy to crash hope that helped
6 0
4 years ago
Read 2 more answers
Given the IPv4 address in CIDR notation 215.200.110.50/25, identify the subnet ID that this address belongs to.
stich3 [128]
215.200.110.00, 215.100.110.64, 215.200.110.128,215.100.110.192
7 0
2 years ago
Select the correct answer.
irinina [24]

Answer:

A

Explanation:

6 0
3 years ago
Other questions:
  • Which area would a Gaming Designer fall under? Research and explain why you think so. Make sure to site your source and where yo
    7·1 answer
  • In which type of land contract does the seller earn interest on the difference between what the seller owes on an existing loan
    14·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    13·1 answer
  • Which principle suggests that specific single responsibility interfaces are better than one general purpose interface?
    13·1 answer
  • What is computer? Write is features <br><br><br><br><br>​
    14·1 answer
  • Select the correct answer from each drop-down menu. The following diagram shows four resistors. What is the effective resistance
    9·1 answer
  • Consider the following method, which is intended to count the number of times the letter "A" appears in the string str.
    13·1 answer
  • Convert 12 bits to bytes​
    13·1 answer
  • 1. Import it into Eclipse. Open the file in Eclipse 2. Edit the file to add comments to identify the instance variables, constru
    9·1 answer
  • When one loop appears inside another, the loop that contains the other loop is called the ____ loop. Group of answer choices ind
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!