Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Need help finishing this Java code.

Here's what I need to do (Write a program to create a customer's bill for a company. The company sells only five different products: TV, VCR, Remote Controller, CD Player and Tape Recorder. The unit prices are $400.00, $220, $35.20, $300.00 and $150.00 respectively. The program must read the quantity of each piece of equipment purchased from the keyboard. It then, calculates the cost of each item, the subtotal and the total cost after an 8.25% sales tax. The input data consists of a set of integers representing the quantities of each item sold. These integers must be input into the program in a user- friendly way; that is, the program must prompt the user for each quantity as shown below - 

 

How many TV's were sold? 3 

How many VCR's were sold? 5 

How many remote controller's were sold? 1 

How many CD's were sold? 2 

How many Tape Recorder's were sold? 4 

 

The output of the program should print the following data properly formatted: 

 

        QTY DESCRIPTION UNIT PRICE TOTAL PRICE 

 

             ...

 

                            SUBTOTAL 

                                 TAX 

                               TOTAL 

 

Define constants for the unit prices and the tax rate. Use integer variables to store the quantities for each item. Use floating-point variables to store the total price of each item, the bill subtotal, the tax amount and and the total amount of the bill.

 

Format the output adequately showing the 4 columns (QTY, DESCRIPTION, UNIT PRICE, TOTAL PRICE) in a single row. Use System.out.printf for output.).

This is my code:

public class Main {

    public static void main(String[] args)

    {

        Scanner scanner = new Scanner

        //Use Constants to find unit prices and the tax amount

        final double TV_P = 400.00;

        final double VCR_P = 220.00;

        final double REMOTE_P = 35.20;

        final double CD_P = 300.00;

        final double TAPE_RECORDER_P = 100.00;

        //Use constant to value the tax amount

        final double TAX = 0.0825;

        //Set the Variables for numbers needed for Inventory

        int tvQ, vcrQ, remoteQ, cdQ, tapeQ;

        double tvTotal, vcrTotal, remoteTotal, cdTotal, tapeTotal;

        double Subtotal, Tax, Total;

 

        // Create inputs for the different quantities

        System.out.println("How many Remotes were sold");

        remoteq = System.currentTimeMillis();

 

        System.out.println("How many CDs were sold");

        cdQ = System.currentTimeMillis();

 

        System.out.println("How many Tape Recorders were sold?");

        tapeQ = System.currentTimeMillis();

 

        System.out.println("How many VCR's were sold?");

        vcrQ = System.currentTimeMillis();

 

        System.out.println("How many TV's were sold?");

        tvQ = system.currentTimeMillis();

 

        // Determine the Total for each item that is given in the quantity

        cdTotal = cdQ * CD_P;

        vcrTotal = vcrQ * VCR_P;

        tvTotal = tvQ * TV_P;

        remoteTotal = remoteQ * Remote_P;

    }

}

 

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education