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
Ads
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
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
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 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 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
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 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 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
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 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... to enter an integer number.
Write a
program in java to find the factorial
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
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.