QuestionQuestion

3. The Assignment
Utilizing what you have learned above and in this chapter, create a Java program that will accept the price of an item and the quantity being purchased of that item. After accepting the input, calculate the amount of the purchase (based on the price and quantity), calculate the sales tax on the purchase, then ouput the product price, quantity, subtotal, sales tax, and the total sale based on the output format shown below.

Structure your file name and class name on the following pattern:
The first three letters of your last name (begin with upper case.).
Then the first two letters of your first name (begin with upper case.).
Follow this with the name of the program: ProductSales.
For a student called ’John Doe,’ the class name and file name would be: DoeJoProductSales

Make sure you have the following in comments at the beginning of your program:
/*
* Program Name: The program name.
* Author: Your first and last name.
* Date Written: The current date.
* The class name: CIT 149 Java 1
* Description: Meaningful description of the purpose of the program.
*/

3.1. Specifications
3.2. Output Format
The first three letters of your last name (begin with upper case.).
Then the first two letters of your first name (begin with upper case.).
Follow this with the name of the program: ProductSales.
For a student called ’John Doe,’ the class name and file name would be: DoeJoProductSales
Remember that the file name must be exactly the same as the class name.
Make sure you have the following in comments at the beginning of your program:
/*
* Program Name: The program name.
* Author: Your first and last name.
* Date Written: The current date.
* The class name: CIT 149 Java 1
* Description: Meaningful description of the purpose of the program.
*/
Name the program ProductSales and format the title as described above by incorporating your name.
Use good comments:
Write a good description of what the program does. I will start grading that as a part of the program. This part is much more important than you might first think. Programmers revise a lot of code and it is important that they (and you) can quickly read important points in the description and other comments, to get a clear idea of how the code works.
Use comments within the code as well, especially on calculations and other areas that might need some explanation.
Think about the problem and decide what type each of the input numbers should be. Also, think about the calculations and decide what type the variables should be that will hold the results of the calculations.
Use camel casing for variable names, and use descriptive variable names. This time I will take points off for variable names like "tax" or "total."
Prompt the user with a statement asking for each of the input values. Clearly express what the user is to enter. Each prompt will be a simple text statement that will appear just prior to the input of the number.
Label all output to match the Output Format section below.
Use the printf() method to format the output of the dollar amounts.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

/*
* Program Name: KalAlProductSales.
* Author:
* Date Written:
* The class name:
* Description: This program is a Product Sales Program.
*/

// Import Library
import java.util.Scanner;

public class KalAlProductSales
{
    // Declaring Sales Tax Rate Constant
    public static final double SALES_TAX_RATE = 0.06;
    public static void main(String[] args)
    {
       // Declaring keyboard input scanner variables
       Scanner stdin = new Scanner(System.in);
       // Declaring number variables
       double prodPri...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$5.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available IT Technical Support Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats