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
GaryK [48]
3 years ago
9

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

r not the transaction was profitable. Here are the details: • Take three separate inputs: the number of shares, the purchase price 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 for the 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 amount you received for the stock. Your program should calculate your net gain or loss during this transaction and print 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:
ser-zykov [4K]3 years ago
4 0

Answer:

#here is code in python.

#read number of shares

num_share = int(input("Enter number of shares:"))

#read purchase price

buy_p = float(input("Enter purchase price:"))

#read sell price

sell_p = float(input("Enter sale price:"))

#total buying cost

buy_cost=buy_p*1.03*num_share

#total selling cost

sell_cost=sell_p*0.97*num_share

#if net profit

if(sell_cost>buy_cost):

   print("After the transaction, you made " +str(sell_cost-buy_cost)+ " dollars.")

#if net loss

else:

   print("After the transaction, you lost " +str(buy_cost-sell_cost)+ " dollars.")

Explanation:

Read the total number of shares from user.Then read buying price of a share and selling price of a share.Then calculate total buying cost including commission.Calculate total selling cost excluding the commission.If total buying cost is greater than total selling cost the print the profit else print the loss in the transaction.

Output:

Enter number of shares:10

Enter purchase price:10

Enter sale price:10

After the transaction, you lost 6.0 dollars.

You might be interested in
Discuss operations of vectors in computer graphics?
Allushta [10]

Answer:

  In the computer graphics, the vectors are basically used to compose various type of components. In the computer graphics it is basically known as vector graphics and it is composed of various types of components.

The operation of the vector in the computer vector is that it is basically used to create the digital images by the use of mathematical statement and command.

It is used to place the lines and the shape in the two- dimension and three- dimension spaces. IN the computer graphics, vectors are also used to represent the particular direction of the various objects.

6 0
3 years ago
Match the cell reference to its definition
Alisiya [41]

Answer:

which cell reference:-|

6 0
3 years ago
Read 2 more answers
Technician A says aluminum cylinder head surfaces should be scraped clean only with nonmetallic tools to avoid gouging. Technici
fredd [130]
<span><span><span /></span></span>Both Technicians (A and B) are correct since the aluminum cylinder head surfaces should be scraped clean only with nonmetallic tools to avoid gouging and it should also be chemically cleaned in accordance with the manufacturer's recommendations before the inspection.<span><span /></span>
6 0
3 years ago
Read 2 more answers
Match each feature of the E publishing as an advantage a disadvantage a threat or an opportunity
natta225 [31]

Answer:

E-publishing is also known as digital publishing or online publishing.It means to publish the content in electronic form.It is growing rapidly.It consist digital publication of e-books,digital magazines that can be read on a screen.

<u>Explanation:</u>E-publishing is very convenient.We do not have to keep  large number of books on the shelves.E-books are best during travelling because we need not to carry heavy luggage of books.E-books are cheaper than paperbacks.

E-publishing can allow the authors  to reach large number of readers.Electronic contents are very well updated.Electronic books are environment friendly.It saves wastage of papers and hence cutting of trees.

Besides above advantages there are some disadvantages of E-publishing:

There are more responsibilities in E-publishing.Chances of copyright infringement can be there.

Profits are very low in case of e-publishing.It is not easy to earn money through this method.

Quality of printed books is much better than e-books.

So we can say that e-publishing has it's own advantages and disadvantages.

3 0
4 years ago
Jorge necesita saber a cuantos grados Fahrenheit esta la temperatura, pero el servicio meteorológico la indica
cupoosta [38]

Answer:

Eso es fácil hermano de matemáticas. Solo haces 9/5 veces c = 18/25 + 32 = 67

Explanation:

8 0
3 years ago
Other questions:
  • To change a selected shape’s height or width to a specific value, type the value in the Height or Width text boxes on the
    14·1 answer
  • The PATH environment variable.
    5·1 answer
  • Why is brainly not working it say im logged out rn but im not i cant acces anything but this
    12·2 answers
  • Someone please help fast! I’m taking the test rn and I don’t understand this!!!!!!
    15·1 answer
  • Angelina wants to modify the footer in her report so the page numbers are correct. To do this, she first double-clicks the foote
    14·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    12·2 answers
  • Vpn stands for _____. very precise settings virtual private network virtual public network vice prestigious setup
    5·1 answer
  • Which of these is a valid use of the Reply All feature?
    11·1 answer
  • Which of the following is an operating system?<br> MacBook Air<br> Windows 10<br> Dell
    13·2 answers
  • A group of two or more computer systems linked together via communication devices is called:.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!