Question
Fenwick Books has asked you to create a program to help calculate a receipt for books purchased. Wirte a Java program that will take in
Fenwick Books has asked you to create a program to help calculate a receipt for books purchased. Wirte a Java program that will take in the number of books ordered and the total price of all books as user input.
Then, the program should perform the following calculations:
- Calculate the sales tax associated with the book order based on a rate of 6%
- Calculate the cost of shipping ($1.50 per book)
- Calculate the grand total cost of the order, including shipping and tax
Finally, the program must print a receipt containing the number of books purchased and the grand total cost of the order. Printed dollar amounts must be formatted to two decimal places.
The example run below shows how the program would run. Note, user input is denoted in orange.
Enter the number of books purchased: 3
Enter the total price of all books: 106.10
**Fenwick Books - Receipt** Number of Books Purchased: 3 Grand Total: $116.97 Note: For input/output, you must use the JOptionPane class. For this lab only, you may assume the user will only enter in valid information. For example, you do not need to account for a negative number of books purchased.
Hint: Remember Integer.parseInt and Double.parseDouble from the lecture notes when gathering input and String.format for outputting dollar amounts!
Your code must compile using the jGrasp IDE. If your code does not compile using jGrasp (for any reason), a grade of 0 will be earned. No exceptions!
Upload your completed .java file. Make sure you upload the .java file and not the .class file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started