12. Stock Transaction Program Last month, Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: • The number of shares that Joe purchased was 2,000. When Joe purchased the stock, he paid $40.00 per share. • Joe paid his stockbroker a commission that amounted to 3 percent of the amount he paid for the stock. Two weeks later, Joe sold the stock. Here are the details of the sale: • The number of shares that Joe sold was 2,000. • He sold the stock for $42.75 per share. • He paid his stockbroker another commission that amounted to 3 percent of the amount he received for the stock. Write a program that displays the following information: • The amount of money Joe paid for the stock. • The amount of commission Joe paid his broker when he bought the stock. • The amount for which Joe sold the stock.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Need help 

PYTHON PROGRAMMING ONLY PLEASE 

NUMBER 12 

am
ent
the
the
of gas
8. Tip, Tax, and Total
Write a program that calculates the total amount of a meal purchased at a restaurant. The
program should ask the user to enter the charge for the food, then calculate the amounts
of a 18 percent tip and 7 percent sales tax. Display each of these amounts and the total.
9. Celsius to Fahrenheit Temperature Converter
mula is as follows:
Write a program that converts Celsius temperatures to Fahrenheit temperatures. The for-
F = ²C + 32
The program should ask the user to enter a temperature in Celsius, then display the tem-
perature converted to Fahrenheit.
10. Ingredient Adjuster
A
cookie recipe calls for the following ingredients:
1.5 cups of sugar
1 cup of butter
• 2.75 cups of flour
Programming Exercises
• 1.5
that
The recipe produces 48 cookies with this amount of the ingredients. Write a program
asks the user how many cookies he or she wants to make, then displays the number of cups
of each ingredient needed for the specified number of cookies.
11. Male and Female Percentages
Write a program that asks the user for the number of males and the number of females regis-
tered in a class. The program should display the percentage of males and females in the class.
Hint: Suppose there are 8 males and 12 females in a class. There are 20 students in the
class. The percentage of males can be calculated as 8 ÷ 20 = 0.4, or 40%. The percentage
of females can be calculated as 12 + 20 = 0.6, or 60%.
12. Stock Transaction Program
Last month, Joe purchased some stock in Acme Software, Inc. Here are the details of the
purchase:
• The number of shares that Joe purchased was 2,000.
• When Joe purchased the stock, he paid $40.00 per share.
Joe paid his stockbroker a commission that amounted to 3 percent of the amount he paid
for the stock.
Two weeks later, Joe sold the stock. Here are the details of the sale:
• The number of shares that Joe sold was 2,000.
• He sold the stock for $42.75 per share.
• He paid his stockbroker another commission that amounted to 3 percent of the amount
he received for the stock.
Write a
program that displays the following information:
The amount of money Joe paid for the stock.
The amount of commission Joe paid his broker when he bought the stock.
• The amount for which Joe sold the stock.
115
Transcribed Image Text:am ent the the of gas 8. Tip, Tax, and Total Write a program that calculates the total amount of a meal purchased at a restaurant. The program should ask the user to enter the charge for the food, then calculate the amounts of a 18 percent tip and 7 percent sales tax. Display each of these amounts and the total. 9. Celsius to Fahrenheit Temperature Converter mula is as follows: Write a program that converts Celsius temperatures to Fahrenheit temperatures. The for- F = ²C + 32 The program should ask the user to enter a temperature in Celsius, then display the tem- perature converted to Fahrenheit. 10. Ingredient Adjuster A cookie recipe calls for the following ingredients: 1.5 cups of sugar 1 cup of butter • 2.75 cups of flour Programming Exercises • 1.5 that The recipe produces 48 cookies with this amount of the ingredients. Write a program asks the user how many cookies he or she wants to make, then displays the number of cups of each ingredient needed for the specified number of cookies. 11. Male and Female Percentages Write a program that asks the user for the number of males and the number of females regis- tered in a class. The program should display the percentage of males and females in the class. Hint: Suppose there are 8 males and 12 females in a class. There are 20 students in the class. The percentage of males can be calculated as 8 ÷ 20 = 0.4, or 40%. The percentage of females can be calculated as 12 + 20 = 0.6, or 60%. 12. Stock Transaction Program Last month, Joe purchased some stock in Acme Software, Inc. Here are the details of the purchase: • The number of shares that Joe purchased was 2,000. • When Joe purchased the stock, he paid $40.00 per share. Joe paid his stockbroker a commission that amounted to 3 percent of the amount he paid for the stock. Two weeks later, Joe sold the stock. Here are the details of the sale: • The number of shares that Joe sold was 2,000. • He sold the stock for $42.75 per share. • He paid his stockbroker another commission that amounted to 3 percent of the amount he received for the stock. Write a program that displays the following information: The amount of money Joe paid for the stock. The amount of commission Joe paid his broker when he bought the stock. • The amount for which Joe sold the stock. 115
116
Chapter 2 Input, Processing, and Output
•
The amount of commission Joe paid his broker when he sold the stock.
Display the amount of money that Joe had left when he sold the stock and paid his
negative, then Joe lost money.
broker (both times). If this amount is positive, then Joe made a profit. If the amount is
13. Planting Grapevines
A vineyard owner is planting several new rows of grapevines, and needs to know how many
grapevines to plant in each row. She has determined that after measuring the length of a
future row, she can use the following formula to calculate the number of vines that will fit
each end of the row:
in the row, along with the trellis end-post assemblies that will need to be constructed at
_ R - 2E
S
V =
The terms in the formula are:
V is the number of grapevines that will fit in the row.
R is the length of the row, in feet.
E is the amount of space, in feet, used by an end-post assembly.
S is the space between vines, in feet.
●
• The length of the row, in feet
Write a program that makes the calculation for the vineyard owner. The
ask the user to input the following:
The amount of space used by an end-post assembly, in feet
• The amount of space between the vines, in feet
The terms in the formula are:
A is the amount of money in the account after the specified number of years.
P is the principal amount that was originally deposited into the account.
r is the annual interest rate.
ber of grapevines that will fit in the row.
Once the input data has been entered, the program should calculate and display the num
14. Compound Interest
When a bank account pays compound interest, it pays interest not only on the principal
amount that was deposited into the account, but also on the interest that has accumulated
over time. Suppose you want to deposit some money into a savings account, and let the
account earn compound interest for a certain number of years. The formula for calculating
the balance of the account after a specified number of years is:
A = P(1 + )"
n is the number of times per year that the interest is compounded.
t is the specified number of years.
program
Write a program that makes the calculation for you. The program should ask the user to
input the following:
• The amount of principal originally deposited into the account
• The annual interest rate paid by the account
should
1.
Us
in.
Figure 2-4
West
Transcribed Image Text:116 Chapter 2 Input, Processing, and Output • The amount of commission Joe paid his broker when he sold the stock. Display the amount of money that Joe had left when he sold the stock and paid his negative, then Joe lost money. broker (both times). If this amount is positive, then Joe made a profit. If the amount is 13. Planting Grapevines A vineyard owner is planting several new rows of grapevines, and needs to know how many grapevines to plant in each row. She has determined that after measuring the length of a future row, she can use the following formula to calculate the number of vines that will fit each end of the row: in the row, along with the trellis end-post assemblies that will need to be constructed at _ R - 2E S V = The terms in the formula are: V is the number of grapevines that will fit in the row. R is the length of the row, in feet. E is the amount of space, in feet, used by an end-post assembly. S is the space between vines, in feet. ● • The length of the row, in feet Write a program that makes the calculation for the vineyard owner. The ask the user to input the following: The amount of space used by an end-post assembly, in feet • The amount of space between the vines, in feet The terms in the formula are: A is the amount of money in the account after the specified number of years. P is the principal amount that was originally deposited into the account. r is the annual interest rate. ber of grapevines that will fit in the row. Once the input data has been entered, the program should calculate and display the num 14. Compound Interest When a bank account pays compound interest, it pays interest not only on the principal amount that was deposited into the account, but also on the interest that has accumulated over time. Suppose you want to deposit some money into a savings account, and let the account earn compound interest for a certain number of years. The formula for calculating the balance of the account after a specified number of years is: A = P(1 + )" n is the number of times per year that the interest is compounded. t is the specified number of years. program Write a program that makes the calculation for you. The program should ask the user to input the following: • The amount of principal originally deposited into the account • The annual interest rate paid by the account should 1. Us in. Figure 2-4 West
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education