Answer to Question #247313 in Java | JSP | JSF for hatipo

Question #247313

Given; Shopping ui ,Product class ,Size class ,Region class

You will create Cart class as a context class to get total price and add product.

To implement Strategy pattern, depending on the country of shipping, the relevant customs duty is charged and the shipping cost of Europe Shopping, America Shopping increases. Large products (XL-size) have an additional charge. Create AmericaShopping and EuropeShopping concrete class. In the USA, the duty tax is 1% and the base delivery fee is $15. In America, an additional tax different from the customs tax is applied and this tax is 0.75. Customs duty should be added to the item fee for each item. In Europe, the customs duty is 1.5% and the base delivery fee is £11. In America, $5 should be added to the shipping fee when each item is added. But if the added product size is XL, $10 should be added to the shipping fee. In Europe, this should only be done if the product size is XL. You are NOT allowed to alter Shopping, Product, Size, Region, and Currency classes.


1
Expert's answer
2021-10-06T07:57:48-0400
import java.util.Scanner;
public class Cart
{
  static void Shopping ()
  {
    Scanner input = new Scanner (System.in);
     System.out.println ("Enter the  price of a product: ");
    double x = input.nextDouble ();
    double charges = 0.01 * x + 15 + 0.75 + 5;
    double fee = 0.015 * x + 11;
    System.out.print("The total charges of the product in America is: ");
    System.out.println (charges);
    System.out.print("The total charges of the product in Euorope is: ");
    System.out.println (fee);
  }
    public static void main (String[]args)
    {
      Shopping ();
    }
  }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS