Java Reference
In-Depth Information
11. Write a Java program that prompts the user to input the elapsed time for an
event in seconds. The program then outputs the elapsed time in hours,
minutes, and seconds. (For example, if the elapsed time is 9630 seconds,
then the output is 2:40:30 .)
12. Write a Java program that prompts the user to input the elapsed time for an
event in hours, minutes, and seconds. The program then outputs the
elapsed time in seconds.
13. To make a profit, a local store marks up the prices of its items by a certain
percentage. Write a Java program that reads the original price of the item
sold, the percentage of the marked-up price, and the sales tax rate. The
program then outputs the original price of the item, the marked-up per-
centage of the item, the store's selling price of the item, the sales tax rate,
the sales tax, and the final price of the item. (The final price of the item is
the selling price plus the sales tax.)
14. A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships
cartons of milk to a local grocery store. The cost of producing one liter of
milk is $0.38, and the profit of each carton of milk is $0.27. Write a
program that does the following:
a. Prompts the user to enter the total amount of milk produced in the
morning
b. Outputs the number of milk cartons needed to hold milk (Round your
answer to the nearest integer.)
c. Outputs the cost of producing milk
d. Outputs the profit for producing milk
15. Redo Programming Exercise 14 so that the user can also input the cost of
producing one liter of milk and the profit on each carton of milk.
16. You found an exciting summer job for five weeks. It pays $15.50 per hour.
Suppose that the total tax you pay on your summer job income is 14%.
After paying the taxes, you spend 10% of your net income to buy new
clothes and other accessories for the next school year and 1% to buy school
supplies. After buying clothes and school supplies, you use 25% of the
remaining money to buy savings bonds. For each dollar you spend to buy
savings bonds, your parents spend $0.50 to buy additional savings bonds for
you. Write a program that prompts the user to enter the pay rate for an
hour and the number of hours you worked each week. The program then
outputs the following:
a. Your income before and after taxes from your summer job
b. The money you spend on clothes and other accessories
c. The money you spend on school supplies
d. The money you spend to buy savings bonds
e. The money your parents spend to buy additional savings bonds for you
Search WWH ::




Custom Search