How to write a program count total prices

How to write a program count total prices

Hi. all
I've got a assignment to write a program that count total prices of 8 costumers.

First class
class PriceCalculator
{print("code sample");
    public void method(double quantity)
    {
    double result;
        if(quantity < 5)
        {
            result = 2.00*quantity;
            System.out.printf(" is: %s",result);
        }
        if(quantity >= 6 & quantity <= 10)
        {
            result = 2.00*quantity*95/100;
            System.out.printf(" is: %s",result);
        }
        if(quantity >= 11 & quantity<= 15)
        {
            result = 2.00*quantity*90/100;
            System.out.printf(" is: %s",result);
        }
        if(quantity >= 16 & quantity<= 20)
        {
            result = 2.00*quantity*85/100;
            System.out.printf(" is: %s",result);
        }
        if(quantity >20)
        {
            result = 2.00*quantity*80/100;
            System.out.printf(" is: %s",result);
        }
    }
}

Second class
import java.util.Scanner;
public class PriceCalculatorTest{
    public static void main(String[] args){
        double enterQ;
        System.out.println("*****WELCOMETO PRICE CALCULATOR FOR PURCHANGSING MILKS*****");
        for(int counter = 1; counter <=8; ++counter)
        {
        Scanner input = new Scanner(System.in);
        PriceCalculator m = new PriceCalculator();
        System.out.printf("Enter the Name for Customer %s: ",counter);
        String name = input.nextLine();
        System.out.printf("Enter the number of cartons for Customer %s: ",counter);
        enterQ = input.nextInt();
        System.out.printf("The price for Customer - %s",name);
        m.method(enterQ);
        System.out.println();
        System.out.println("-------------------------------------------");

        }

    }
}

The problem is I'm being absolutely stuck in count total prices of 8 costumers like in this picture
![alt text][1]


  [1]: [IMG]http://i241.photobucket.com/albums/ff33/vanvi_1987/Untitled.jpg[/IMG]

Is there anyone,please help me..
Really thanks a lot
View Answers









Related Tutorials/Questions & Answers:
How to write a program count total prices
How to write a program count total prices  Hi. all I've got a assignment to write a program that count total prices of 8 costumers. class PriceCalculator{ public void method(double quantity) { double result
How to write a program count total prices
How to write a program count total prices  Hi. all I've got a assignment to write a program that count total prices of 8 costumers. First class... stuck in count total prices of 8 costumers like in this picture ![alt text][1
Advertisements
Java program to generate the total count
Java program to generate the total count  I need a java program which would take a text file as an input and scans through it to generate the output. For Ex. : If the text file contains the following information: There is/are 3
Modify the sales tax program to accept an arbitrary number of prices, total them, calculate the sales tax and print the total amount.
Modify the sales tax program to accept an arbitrary number of prices, total them, calculate the sales tax and print the total amount.  Modify the sales tax program to accept an arbitrary number of prices, total them, calculate
how to write this program
how to write this program  Write a program in java which calculates... + Class2Hours *Class2GPA +â?¦ +Class6hours * Class6GPA) / Total Hours For this program... or numerical grade. You will be submitting TWO versions of this program. Write one
How to write Java Program
How to write Java Program  how to write a program to find average of 5 student marks
How to write calculator in J2ME program?
How to write calculator in J2ME program?  How to write calculator in J2ME program
how to write servlet program in eclipse?
how to write servlet program in eclipse?  how to write servlet program in eclipse
how to write this program? - Java Beginners
how to write this program?  (game:scissor,rock ,paper) A program that plays the sciccor-rock-paper game.Revise the program to let the user continuously play until either the user or the computer wins more than 4 times
how to write the program - Java Beginners
how to write the program  WAP to create the report card user input Name, Class, Division, Roll no., Marks obtained in following subjects Lang Hindi History Geography Math Phy Chem. Bio Eve CSTA Also has a back up
Write a query to find the total number of rows in a table
Write a query to find the total number of rows in a table  Write a query to find the total number of rows in a table?   Hi, Here... find the total number of rows in a table using following query, Select count
program to print total marks
program to print total marks  program to input total marks out of 600 marks as an argument and print the stream allotted using the following criteria 401 & above - PCM 301-400 - ZBC 201-300- Commerce 101-200 - Arts
how to write a program to search a record using mvc2
how to write a program to search a record using mvc2   how can we write a code to search a record in table by using java bean as model, servlet as contoller and jsp as view
how do i write a java program for this??
how do i write a java program for this??  ??Ask the user if they have a dog. If ??yes??, ask the user how old is and compute the dog??s age... in your program
write a program
write a program  write a program add 2 no.s without use arithmetic,unary operaters in java
How to Write a Calculator Program in Java?
How to Write a Calculator Program in Java? In this Java Tutorial you will learn how to write a Calculator program in Java in easy steps. Calculator program..., subtraction, multiplication or division. In this example of writing program in Java
How to write program to show status of seats(i.e.free or reserve) in java?
How to write program to show status of seats(i.e.free or reserve) in java?  I have retrieved data from database table and I want to display status of seats i.e.free or reserved
how can i write this program ?please suggest me
how can i write this program ?please suggest me  Program to calculate the sum of two big numbers (the numbers can contain more than 1000 digits). Don't use any library classes or methods (BigInteger etc
how to write to java program to get the particular data from the website
how to write to java program to get the particular data from the website   i have to get the particular data by selecting the just numbers.. from the site .. how to get the ful details from the website by clicking the number
how to write a program in java to print numbers in equalateral triangle
how to write a program in java to print numbers in equalateral triangle  the output must be 1 324 76589   Here is an example of pattern 1 2 3 4 5 6 7 8 9 Example: (adsbygoogle = window.adsbygoogle
write a java program
write a java program  write a program to print '*' in a circular form
How do I write a program to manage an employee's business and personal contacts?
How do I write a program to manage an employee's business and personal contacts?  A. Input Requirements 1. Include a prompt that allows the user to enter a command from the following four options, repeating the process
Write a java application program........?
Write a java application program........?  Welcome every One : I have Q in Java? Q : Write a java application program that reads 20 integer numbers input by the user and prints how many numbers > 100 and how many numbers
WRITE A PROGRAM IN JAVA
WRITE A PROGRAM IN JAVA  Write program which accepts five students id,name,age,department,courses, taken and its grade. a. calculate its GPA . display all student information in ascending order
write the java program?
write the java program?  1 11 121 1331 14641 15101051
write the java program?
write the java program?  1 11 121 1331 14641 15101051
How to write hello world example program in Hibernate?
How to write hello world example program in Hibernate? Hello World tutorial is first example program for a beginners leaning Hibernate ORM language... is for beginners which teaches you to write code for inserting data in the database
write a program to print
write a program to print   write a program to print following 1 2 3 4 5 4 3 2 1 1 2 3 4 4 3 2 1 1 2 3 3 2 1 1 2 2 1 1 1
Write java program?
Write java program?  1 11 121 (adsbygoogle = window.adsbygoogle || []).push({}); 1331 14641 15101051 (adsbygoogle = window.adsbygoogle || []).push
Write java program?
Write java program?  1 11 121 (adsbygoogle = window.adsbygoogle || []).push({}); 1331 14641 15101051 (adsbygoogle = window.adsbygoogle || []).push
WRITE A PROGRAM IN JAVA
WRITE A PROGRAM IN JAVA  How do I write a program in Java, have the program display a message with your name in it and a number (Hello john Smith!1) The number must increment from zero to nine, or decrement fron nine to zero. You
write a program - Java Beginners
write a program  1. write a program that reads a string composed of 6 words then generate and print a word composed of the first letters of the 6 words.  Hi friend, Code to solve the problem : class FirstLetter
Write a program in java...
Write a program in java...  Hi, friends Please, can you help me? Q1: Write a program in java to simulate a calculator. Your program should take two... an integer number. Write a program in java to find the factorial of a non negative
write following program
write following program  Q1 What is the difference between single...-threading. Explain with examples Q2 Write a java applet that takes your name through a parameter from the HTML file and displays it Q3 Write a short note
Find total disk space in PHP, php disk_total_space, disk_total_space
Learn How to Get the total disk space in PHP Program. In this PHP Tutorial example we will use the disk_total_space() function in our PHP code to find the total disk space. (adsbygoogle = window.adsbygoogle || []).push
write program - Java Beginners
write program  write a java program that will read the values of matrix A and B give its multiplication in matrix C  Hi friend, Code for Matrix Multiplication : class MatrixMultiplication{ public static void
write a program in java.
write a program in java.  arrange the natural n umber in 5x5 matrix as 21 22 23 24 25 20 7 8 9 10 19 6 1 2 11 18 5 4 3 12 17 16 15 14 13 i at centerd position and remaining arrange in anticlockwise direction
Write a program to print using for loop
Write a program to print using for loop  Write a program to print using for loop * * * *  
really need help on how to write this program plz some 1 help out. - Java Beginners
really need help on how to write this program plz some 1 help out.  i am confused here on what to write can some 1 help out here i dont quite understand how to code it so can some 1 help out. Part II Write, compile and execute
How can I write a GUI stack program by Java to push Image files instead of other data type items?
How can I write a GUI stack program by Java to push Image files instead of other data type items?   How can I write a GUI stack program by Java to push Image files instead of other data type items? for the push instruction I
ModuleNotFoundError: No module named 'prices'
ModuleNotFoundError: No module named 'prices'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'prices' How to remove the ModuleNotFoundError: No module named 'prices'
ModuleNotFoundError: No module named 'prices'
ModuleNotFoundError: No module named 'prices'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'prices' How to remove the ModuleNotFoundError: No module named 'prices'
ModuleNotFoundError: No module named 'prices'
ModuleNotFoundError: No module named 'prices'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'prices' How to remove the ModuleNotFoundError: No module named 'prices'
write a program to create a user defined
write a program to create a user defined   plz send me code   Hi Friend, Please specify what do you want to create? (adsbygoogle = window.adsbygoogle || []).push({}); Thanks
Java Count Vowels
Java Count Vowels       In this program you will learn how to count vowels in a String. Here you... = window.adsbygoogle || []).push({}); In the program code given below, you
How to write in File in Java
How to write in File in Java  Hi, How to write in File in Java. Please suggest and give example of this program. thanks. (adsbygoogle = window.adsbygoogle || []).push
to write a program to display the employee details..
to write a program to display the employee details..  To dipslay... running this program the new window has to be opened asking us to enter all...;not this one actually i wnat a very small program that displays all the details
Write a java program that prints out the following menu???
Write a java program that prints out the following menu???  Write a java program that prints out the following menu. Auser can interact with the menu... a random number from (0-9). 3. Count number of Capital and Small for inputted
Write a program named InternetCharge_YourLastName that do the following:
Write a program named InternetCharge_YourLastName that do the following: ... per month unlimited access is provided. Write a program named InternetCharge... the total charge in the following format. The total charge will include the tax 8.5
array variable in a java program
array variable in a java program  How do i write a program that will prompt the user for a list of 5 prices, that cosist of the sum of all the prices, the average of the prices, and all prices that are higher than the calculated

Ads