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;
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("---------");
}
}
}
Is there anyone,please help me..
Really thanks a lot
View Answers
Related Tutorials/Questions & Answers:
How to write a program count total pricesHow 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 pricesHow 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 countJava
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 programhow 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 this program? - Java Beginnershow 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
program to print total marksprogram 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 the program - Java Beginnershow 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 programwrite a program
write a
program add 2 no.s without use arithmetic,unary operaters in java
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 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 mehow 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 JAVAWRITE 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 JAVAWRITE 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 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 a program - Java Beginnerswrite 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 following programwrite 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 program - Java Beginnerswrite 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.
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
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'
Java Count Vowels
Java
Count Vowels
In this
program you will learn
how to
count vowels in a
String. Here you...
In the
program code given below, you will be asked to
enter the String first as can
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