Critical Thinking Exercise Imagine that you and your band ha

Critical Thinking Exercise: Imagine that you and your band have just recorded a song, and you want to permit fans to purchase and download the song over the Internet. Your manager receives a commission equal to 12% of the total sales revenue for your song, and the Internet site that lists your song receives a 3% commission. Design a Java program that asks the user for the title of the song, the purchase price of the song (in dollars and cents), and the num- ber of copies of the song that have been sold. Calculate the total revenue generated by your song, the commission received by your manager, and the commission received by the Inter- net site. Use named constants for the commission rates.

Solution

import java.util.Scanner; public class SongSales { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print (\"\ This program calculates the revenue earned and commission paid for a song over the internet.\ \"); String song_name; double song_price; double copies_sold; System.out.print (\"Please enter the name of the song:\ \"); song_name = console.next(); System.out.print (\"Please enter the selling price in dollars and cents:\ \"); song_price = console.nextDouble(); System.out.print (\"Please enter the number of copies sold:\ \"); copies_sold = console.nextDouble(); System.out.print (\"\ \" + copies_sold +\" copies of the song \" + song_name +\" were sold at $\" + song_price +\" per copy, for a total revenue of $\" + (song_price * copies_sold) +\"\ \"); System.out.print (\"\ The commission received by your agent is $\" + ((song_price * copies_sold) * .12)); System.out.print (\"\ The commission received by the Internet site is $\" + ((song_price * copies_sold) * .03)); System.out.print (\"\ \" +\"\ \"); } }
 Critical Thinking Exercise: Imagine that you and your band have just recorded a song, and you want to permit fans to purchase and download the song over the In

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site