Answer:
public static void main(String[] args)
{
int cdCount;
double cdCountAfterDiscount;
DecimalFormat df = new DecimalFormat("$##.##"); // Create a Decimal Formatter for price after discount
System.out.println("Enter the amount of CD's bought");
Scanner cdInput = new Scanner(System.in); // Create a Scanner object
cdCount = Integer.parseInt(cdInput.nextLine()); // Read user input
System.out.println("CD Count is: " + cdCount); // Output user input
if(cdCount <= 14 )
{
System.out.println("There is no discount");
System.out.println("The final price is " + cdCount*3.5);
}
if(cdCount >= 15 && cdCount<=50)
{
System.out.println("You have a 1% discount.");
cdCountAfterDiscount = (cdCount *3.5)-(3.5*.01);
System.out.println("The final price is " + df.format(cdCountAfterDiscount));
}
if(cdCount >= 51 && cdCount<120)
{
System.out.println("You have a 5% discount.");
cdCountAfterDiscount = (cdCount *3.5)-(3.5*.05);
System.out.println("The final price is " + df.format(cdCountAfterDiscount));
}
if(cdCount >= 120)
{
System.out.println("You have a 10% discount.");
cdCountAfterDiscount = (cdCount *3.5)-(3.5*.1);
System.out.println("The final price is " + df.format(cdCountAfterDiscount));
}
}