modify program
Hi how could I modify this program so that if I say yes for the dialog the following prompt would be displayed for the user to enter the information and would stop if no is selected.As the program is now if I say yes only the user input for the code and quantity is displayed,thank you.
address 1:
address 2:
address 3:
post code:
code:
quantity:
the is the program
mport java.util.*;
import java.text.*;
import java.util.Scanner;
class HardwareItems
{
String code;
String description;
double price,total;
double vat=0.2;
int weight,quantity,shipping, cost;
HardwareItems(String code,String description,double price){
this.code=code;
this.description=description;
this.price=price;
}
public String getCode(){
return code;
}
public String getDescription(){
return description;
}
public double getPrice(){
return price;
}
public static void main(String []args){
ArrayList<HardwareItems> list=new ArrayList<HardwareItems>();
list.add(new HardwareItems("K16","Wood screws,brass,20mm,50 grams",7.75));
list.add(new HardwareItems("D24","Wood glue,clear,1 liter,350 grams",5.50));
list.add(new HardwareItems("M93","Sandpaper,fine grade,50 grams",10.25));
list.add(new HardwareItems("M94","Sandpaper,fine grade,60 grams",14.75));
list.add(new HardwareItems("B21","Claw Hammer,1500 grams",13.50));
list.add(new HardwareItems("B35","Garden Shovel,2200 grams",15.00));
list.add(new HardwareItems("A10","Garden Hose,2100 grams",10.25));
list.add(new HardwareItems("A45","Hand Saw,1000 grams",12.75));
list.add(new HardwareItems("C51","Garden Fork,2400 grams",14.50));
DecimalFormat df=new DecimalFormat("$ ##.##");
System.out.println("Hardware Items");
System.out.println();
System.out.println("Code "+" Description "+" Unit Price ");
for(HardwareItems e : list){
System.out.println(e.getCode()+"\t"+e.getDescription()+"\t"+df.format(e.getPrice()));
}
Scanner in=new Scanner (System .in);
System.out.println("place your order!");
System.out.print("NAME:");
String l=in.nextLine();
System.out.print("ADDRESS-1:");
String m=in.nextLine();
System.out.print("ADDRESS-2:");
String n=in.nextLine();
System.out.print("ADDRESS-3:");
String o=in.nextLine();
System.out.print("POST CODE:");
String p=in.nextLine();
Scanner input=new Scanner(System.in);
System.out.print("Code:" );
String code=input.next();
System.out.print("Quantity: ");
int quantity=input.nextInt();
String check="";
while(!check.equals("no")){
System.out.print("Is there another Customer order?(yes/No) :");
check=input.next();
if(check.equals("yes")){
System.out.print("Code:" );
code=input.next();
System.out.print("Quantity: ");
quantity=input.nextInt();
}
else{
break;
}
}
}
}
View Answers
Related Tutorials/Questions & Answers:
modify programmodify program Hi how could I
modify this
program so that if I say... the information and would stop if no is selected.As the
program is now if I say....
address 1:
address 2:
address 3:
post code:
code:
quantity:
the is the
program Advertisements
date_modifydate_
modify() in PHP
date_
modify or DateTime::
modify function modifies... by strtotime(). It returns the
modify date time.
Description
public DateTime DateTime::
modify ( string $
modify )
DateTime date_
modify ( DateTime $object
Modify Data Type with ALTER CommandModify Data Type with ALTER Command Is it possible to
modify... EmpName INT;
Is it possible to
modify the above table like... the following query:
ALTER TABLE Emp
MODIFY EmpName int(255
how to modify content of XML filehow to
modify content of XML file hi,
I want to
modify content of a xml file.There are two tags of similar name
say
<ContentName>C:\Myinfo...
modify....!!!
How do i do it??can somebody give me a sample code
how to modify hosts file in ubuntuhow to
modify hosts file in ubuntu Hi,
I want to add few host names with ip address in Ubuntu.
how to
modify hosts file in ubuntu?
Thanks
...
modify hosts file in Ubunut.
Thanks
can modify this application connection with database can
modify this application connection with database hi i'm want to say who thank java master or java professional help me convert Java applet...
modify connection with database ?
import javax.swing.*;
import java.applet.
programprogram any
program of hotel or school management
programprogram
program of jdbc using ms access for creating table
programprogram write a javascript
program to create a application form with validation
programprogram write a html
program in show table and this word
in box
programprogram write a
program different between to dates in terms of days in java
programprogram WAP a java
program to form 1/2+3/4+5/6+7/8 series
programprogram Write a
program to find the difference between sum of the squares and the square of the sums of n numbers
programprogram write a
program reversee a string.
input-hi this is roseindia
output-roseindia is this hi
programprogram develop a servlet to insert the data in the database from our
program in the table stored in the database
programprogram An old-style movie theater has a simple profit
program. Each customer pays $5 per ticket. Every performance costs the theater $20, plus $.50 per attendee. Develop the
program calculateTotalProfit that consumes
programprogram write a java
program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
programprogram Develop the
program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder
programprogram explanation of
program on extending thread class
Hi Friend,
Please go through the following link:ADS_TO_REPLACE_1
Java Threads
Thanks
programprogram Develop a
program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time, and the Pythagorean
programprogram how to improve programming skills plss tell some tips..i am understanding concepts but unable to write
program so,pls give some guideness plsss
ProgramProgram a
program to prove that default constructor of super class is available to subclass by default. Define a parameterize constructor for super class to store name = â??Tommyâ?? age=â??23â?? and call this constructor
ProgramProgram a
program to create two classes Commercial and Domestic. Override the method calculatebill() of Commercial class(Rs.8 per unit) into Domestic class(Rs 6 per unit) to compute electricity bill for both classes
programprogram no i want a
program that shows how merge sort algorithm works in graphical representations like numbers are taken in circles and computation... in rectangles or circles wat ever it may be. the theme of
program is to show algorithm
programprogram . Develop a
program that accepts an initial amount of money (called the principal), a simple annual interest rate, and a number of months will compute the balance at the end of that time. Assume that no additional
programprogram Write a JSP
Program, which displays a web page containing the name of the Courses, Courses being offered currently, number of students enrolled in each course, new courses to be offered, eligibility criteria for taking
programprogram i want a progra in java to print a sentence in alphabetic order, taking the input from the user.the
program should writen without using the array
for example : if input= this is a cat
then output sould = a cat
programprogram Utopias tax accountants always use programs that compute income taxes even though the tax rate is a solid, never-changing 15%. Define the
program calculateTax which determines the tax on the gross pay. Define
programprogram Write a JSP
Program, which displays a web page containing two web links one for your profiling and other for the schedule of theory of practical classes of your Batch. When one click on link for getting your profile
programprogram Write a
program to print details of a week for a particular day using array of objects Integer and String.
OUTPUT:
First Day of Week is Monday
Second Day of Week is Tuesday
Third Day of Week is Wednesday
Forth Day
Java-Xml -Modify and Update Node - Java BeginnersJava-Xml -
Modify and Update Node
test_final_1
2009-025T13:23:45
B2B
and using the following code...
import javax.xml.parsers....();
}
}
I want to
modify the values of and in the above xml posted and update
Java--Xml Modify Node Value - Java BeginnersJava--Xml
Modify Node Value I have the following xml.
test_final_1
2009-025T13:23:45
B2B
.
I want to retrieve the values of ,,and through NodeList.
I wrote the follwoing code.
package xml_handson;
import
modify this so that i can work better - Swing AWTmodify this so that i can work better this
program is about opening a savings account, i need any one to
modify it and add new features to it to make i more better.
the codes are;
//OpenSavingsAccount1.java
import
Please help me to modify my java code from php codePlease help me to
modify my java code from php code i want to covert this php code int java/JSP .
if (isset($_POST['orders'])) {
$orders = explode('&', $_POST['orders']);
$array = array();
foreach($orders as $item