package Dialogs;
import java.text.DecimalFormat;
import java.util.Scanner;

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    Scanner newdata =new Scanner(System.in);
    DecimalFormat df = new DecimalFormat(".00");
    int newprogram;
    int count = 0;
    double Total1;

    System.out.print("How many items in a counter? : ");
        int Item = sc.nextInt();
        String new1 [] = new String [Item];
        int new2 [] = new int [Item];
        double new3 [] = new double [Item];

        double Totalnew1, Totalnew2, value;
        System.out.println();

    for(int i = 0; i< new1.length; i++){
        count++;
        System.out.println("\nDrug Item "+count);

        System.out.print("Enter The Drug Name : ");
        new1 [i] = sc.next();
        System.out.print("Enter Quantity: ");
        new2 [i] = sc.nextInt();
        System.out.print("Enter Price   : ");
        new3 [i]  = sc.nextDouble();
        System.out.println("");
        }

    System.out.println("\n====================  [ SUMMARY OF ORDERS  ]  ===================");
    System.out.println("Drug Name      Quantity       Item Price        Total Price");

    for(int i = 0; i < new1.length; i++){
        System.out.print(new1[i]);
        System.out.print("         "+new2[i]);
        System.out.print("             "+df.format(new3[i])+"          ");

        Total1 = new2[i]*new3[i];
        System.out.println(df.format(Total1));
    }
    }
    }
    // I want to know How to get this?
    [  TOTAL SUMMARY  ]

Total Price 450.00
After Tax 484 // 450 + Vat
VAT Tax ( 12% ) 54 // 450 .12
Discount ( 20% ) 96.8 // after tax
.20
=============================

Total Price Tax
With VAT /Discount 96.8 // Discount

======================================================
[1]Cash
[2]Credit Card
Choose Type Are : 1

======================================================
Amount of Pay
387.2 // After Tax - Discount

Cash
400 //

Exchange
12.8 // Cash - Amount

Recommended Answers

All 2 Replies

The formatting seems off here. Those first three lines of your post seem to belong in the code.

What exactly is your question? How to get the total prize at the bottom?

You can add something like this:

double sum = 0.0;

for(int i = 0; i < new1.length; i++){
        System.out.print(new1[i]);
        System.out.print("         "+new2[i]);
        System.out.print("             "+df.format(new3[i])+"          ");

        Total1 = new2[i]*new3[i];
        sum += Total1;
        System.out.println(df.format(Total1));
    }

    System.out.println("\n Total: \t" + sum);

I would recommend respecting naming conventions, though: don't start variable names (like Total1) with a capital.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.