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
alisha [4.7K]
3 years ago
10

You decide to buy some stocks for a certain price and then sell them at anotherprice. Write a program that determines whether or

not the transaction wasprofitable. Here are the details:• Take three separate inputs: the number of shares, the purchaseprice of the stocks, and the sale price, in that order.• You purchase the number of stocks determined by the input.• When you purchase the stocks, you pay the price determined by the input.• You pay your stockbroker a commission of 3 percent on the amount paid forthe stocks.• Later, you sell the all of the stocks for the price determined by the input.• You pay your stockbroker another commission of 3 percent on the amountyou received for the stock.Your program should calculate your net gain or loss during this transaction andprint it in the following format:If your transaction was profitable (or if there was a net gain/loss of 0) print:"After the transaction, you made 300 dollars."(If, for example, you gained 300 dollars during the transaction.)If your transaction was not profitable, print:"After the transaction, you lost 300 dollars."(If, for example, you lost 300 dollars during the transaction.)Use string formatting.
Computers and Technology
1 answer:
Otrada [13]3 years ago
7 0

Answer:

no_of_shares = int(input("Enter the number of shares: "))

purchase_price = float(input("Enter the purchase price of the stock: "))

sale_price = float(input("Enter the sale price of the stock: "))

total_stock_price = purchase_price*no_of_shares

total_spend_on_buying = total_stock_price + (0.03*total_stock_price)

total_sale_price = sale_price*no_of_shares

commission_while_selling = total_sale_price*0.03

net_gain_or_loss = total_sale_price - (total_spend_on_buying + commission_while_selling)

if(net_gain_or_loss<0):

print("After the transaction, you lost {} dollars".format(abs(net_gain_or_loss)))

else:

print("After the transaction, you made {} dollars".format(abs(net_gain_or_loss)))

You might be interested in
The process of making raw materials into a finished product is known as
Olin [163]
1.) Business Engineering or Manufacturing :)
<span />
6 0
2 years ago
Read 2 more answers
If I make a Zoom Meeting, would you join it?
boyakko [2]

Most likely, yeah lol.

3 0
3 years ago
Read 2 more answers
Define a method calcPyramidVolume with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a d
enyata [817]

Answer:

The method in C++ is as follows:

double calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight){

   double baseArea = calcBaseArea(baseLength, baseWidth);

   double volume = baseArea * pyramidHeight;

   return volume;    

}

Explanation:

This defines the calcPyramidVolume method

double calcPyramidVolume(double baseLength, double baseWidth, double pyramidHeight){

This calls the calcBaseArea method to calculate the base area of the pyramid

   double baseArea = calcBaseArea(baseLength, baseWidth);

This calculates the volume

   double volume = baseArea * pyramidHeight;

This returns the volume

   return volume;  

}

<em>See attachment for complete program that include all methods that is required for the program to function.</em>

5 0
3 years ago
If you use your smartphone as a hotspot to connect to the Internet on your tablet you are using a ________.quillet
Nataly [62]
Personal Area Network
7 0
2 years ago
Universal Containers (UC) has decided to build a new, highly sensitive application on the Force platform. The security team at U
Tresset [83]

Use an AppExchange product that does fingerprint scanning with native Salesforce Identity  Confirmation

8 0
3 years ago
Other questions:
  • The RESET circuit used on the four 3-Bit Counters analyzed in this activity reset the counts to zero (000). It makes sense for t
    14·1 answer
  • Consider a network of 8 routers connected together to provide more than one path of connectivity between host A and host B at tw
    8·1 answer
  • python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. T
    12·1 answer
  • You suspect a component in a computer is fried. You remove any unnecessary hardware devices one by one to narrow down where the
    7·1 answer
  • Describe the difference between a myth and a fable.
    12·1 answer
  • Draw a circuit with a 12-volt battery, a 100 ohms resistor in series, and two resistors (each of value 200 ohms) in parallel. Wh
    9·1 answer
  • Using the Impress program, you can add multimedia files, including audio, image, and video files, to the presentation
    13·2 answers
  • If you have limited means, you...?
    9·1 answer
  • Write a method in pseudocode or Java called move that accepts a boolean[], integer value, and a boolean value. Your method shoul
    15·1 answer
  • Dion Training has hired you to assess its voucher fulfillment web application on its e-commerce website. The web application rel
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!