Question: public class RegaliaOrder { / * * * @param args * / public static void main ( String [ ] args ) { / /

public class RegaliaOrder
{
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
final double CUSTOMIZATIONPRICE =10.50;
final double TAX =.065;
final double sc =.05;
final double MASTERSHOODPRICE =40.0;
final double BFPRICE =50.0;
final double MFPRICE =95.0;
int numberOfRegalia =0;
String typeOfRegalia ="";
String design ="";
String customization ="";
String keepShopping ="y";
int mCount =0;
int bfCount =0;
int mfCount =0;
int customizationCount =0;
Scanner myScan = new Scanner(System.in);
System.out.println("Welcome red bird graduates ");
System.out.println("M - Masters Hood "+ MASTERSHOODPRICE);
System.out.println("BF - Bachelors Cap, Gown, and Tassel "+ BFPRICE);
System.out.println("MF - Masters Cap, Gown, and Tassel "+ MFPRICE);
do
{
System.out.println("enter the number of regalia you would like to purchase: ");
numberOfRegalia = myScan.nextInt();
for (int i =1; i <= numberOfRegalia; i++)
{
System.out.println("What type(M/BF/MF): "+"
");
typeOfRegalia = myScan.next();
if (typeOfRegalia.equalsIgnoreCase("M"))
{
mCount++;
} else if (typeOfRegalia.equalsIgnoreCase("BF"))
{
bfCount++;
} else if (typeOfRegalia.equalsIgnoreCase("MF"))
{
mfCount++;
}
System.out.println("Would you like a custom school design (y/n)");
design = myScan.next();
if (design.equals("y"))
{
System.out.println("We provide the following at $10.50 eash: ");
System.out.println("A - Custom Gown W/School Custom Zipper Pull and Patch");
System.out.println("B - Custom Tassel W/School Custom charm ");
System.out.print("Which customization would you like? (a/b): ");
customization = myScan.next();
if (customization.equalsIgnoreCase("a"))
{
customizationCount++;
} else if (customization.equalsIgnoreCase("b"))
{
customizationCount++;
}
}
System.out.print("Would you like to keep shopping? (y/n): ");
keepShopping = myScan.next();
}
} while (keepShopping.equals("y"));
System.out.println("Please enter shipping information");
System.out.print("First Name: ");
String first = myScan.nextLine();
System.out.print("last Name: ");
String last = myScan.nextLine();
System.out.print("Street Adress: ");
String adress = myScan.nextLine();
System.out.print("City: ");
String city = myScan.nextLine();
System.out.print("State: ");
String state = myScan.nextLine();
System.out.print("Zip code: ");
int zc = myScan.nextInt();
System.out.println("ORDER SUMMARY");
System.out.println("Graduation regalia: "+ numberOfRegalia);
System.out.println("Masters Hood: "+ mCount);
System.out.println("Bachelors Cap, Gown, and Tassel: "+ bfCount);
System.out.println("Masters Cap, Gown, and Tassel: "+ mfCount);
System.out.println("Custom Designs: "+ customizationCount);
double mHoodTotal = mCount * MASTERSHOODPRICE;
double bftotal = BFPRICE * bfCount;
double mftotal = MFPRICE * mfCount;
double customizationTotal = CUSTOMIZATIONPRICE * customizationCount;
double subtotal = mHoodTotal + bftotal + mftotal + customizationTotal;
double fTax = TAX * subtotal;
double fSC = sc * subtotal;
double total = subtotal + fTax + fSC;
System.out.println("Subtotal: "+ subtotal);
System.out.println("tax: "+ fTax);
System.out.println("Shipping cost: "+ fSC);
System.out.println("Total: "+ total);
System.out.println("This order will be shipped to");
System.out.println(first + last);
System.out.println(adress);
System.out.println(city +","+ state + zc);
}
} how do i implement decimal format to this code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!