Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a java program that calculates the total price for the book order. The pro

ID: 3566113 • Letter: W

Question

Write a java program that calculates the total price for the book order. The program should prompt the user (input) for teh price of each book, and the number of copies of the book ordered. It then should calculate and display the total price of the order considering shipping charge based on the following conditions:

1.) If the number of books ordered is less than 5 the flat shipping charge is $10.00

2.) If the number of books ordered is between 5 and 10 the flat shipping charge is $15.00

3.) If the number of books ordered is more than 10 the flat shipping charge is $20.00

Explanation / Answer

====================================

Program Name : BookOrder.java

====================================

import java.util.Scanner;


public class BookOrder {

   public static void main(String[] args) {
  


       Scanner sc = new Scanner(System.in);
       double priceOfBook;
       int numberOfCopies;
       double shippingCharge=0.0;
       double totalPrice;      
       System.out.println("Enter tech price of book");
       priceOfBook = sc.nextDouble();
      
       System.out.println("Enter number of copies");
       numberOfCopies = sc.nextInt();
      
       if(numberOfCopies<5) {
           shippingCharge = 10;
       } else if(numberOfCopies>=5 && numberOfCopies<=10) {
           shippingCharge = 15;
       } else if(numberOfCopies>10){
           shippingCharge = 20;
       }
      
       totalPrice = numberOfCopies*priceOfBook + shippingCharge;
       System.out.println("The total price for the book order is");
       System.out.println("$"+totalPrice);
  
   }

}

===============================================

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote