Click here to Skip to main content
       

Java

 
GeneralRe: Read JNDI from c# PinmvpRichard MacCutchan9-Apr-13 9:40 
GeneralRe: Read JNDI from c# PinmemberMember 111849410-Apr-13 22:55 
GeneralRe: Read JNDI from c# PinmvpRichard MacCutchan10-Apr-13 23:14 
GeneralRe: Read JNDI from c# PinmemberMember 111849410-Apr-13 23:21 
GeneralRe: Read JNDI from c# PinmvpRichard MacCutchan11-Apr-13 0:38 
GeneralRe: Read JNDI from c# PinmemberMember 111849411-Apr-13 0:42 
SuggestionRe: Read JNDI from c# PinprofessionalPrasad Khandekar2-May-13 19:49 
QuestionJava Program to accept input from user and then display output . PinmemberAman kumar routh4-Apr-13 3:35 
I need to make a java program which accepts input from user in form of item Code, quantity and rate and then display the total amount as well as discount .
the condition for getting discount is like
if the amount is greater than 5000 than discount is 10% of amount. i want to display amount and discount amount calculated ...my code works nice till it calculates amount but when moving to next step for calculating discount it shows error.
 
plzzz hep me out ...is there any error in my code??
am new to Core java
thank you...
 

import java.io.*;
class AMOUNT
{
public static void main(String args[])
{
Double discount= 0.0 ;
InputStreamReader istream = new InputStreamReader(System.in) ;
BufferedReader br= new BufferedReader(istream);
System.out.println("Welcome to My Java Program");
try
{
System.out.println("enter the item code:");
String code=br.readLine();

System.out.println("enter your quantity:");
String quantity=br.readLine();

System.out.println("enter the rate:");
String rate=br.readLine();

int qty=Integer.parseInt(quantity);
int Rate=Integer.parseInt(rate);



int amnt= qty*Rate;
System.out.println("your amountis"+amnt);

if(amnt > 5000)
{
discount=Double.parseDouble(br.readLine());
discount= 0.1 * amnt;
System.out.println("your discount is"+discount);
}
else
{

System.out.println("you dont have discount");
}
}
catch (Exception e)
{
System.out.println("error");

}
}
}
Aman Kumar Routh

AnswerRe: Java Program to accept input from user and then display output . Pinmemberemadrefai4-Apr-13 6:20 
GeneralRe: Java Program to accept input from user and then display output . PinmemberAman kumar routh4-Apr-13 6:29 
AnswerRe: Java Program to accept input from user and then display output . PinmvpRichard MacCutchan4-Apr-13 6:29 
QuestionJAVA PinmemberMember 995424830-Mar-13 8:01 
AnswerRe: JAVA PinmvpRichard MacCutchan30-Mar-13 13:19 
AnswerRe: JAVA PinmemberShubhashish_Mandal1-Apr-13 2:43 
AnswerRe: JAVA PinmemberCesar Bretana Glez3-Apr-13 9:43 
AnswerRe: JAVA PinmemberAman kumar routh4-Apr-13 3:46 
AnswerRe: JAVA PinmvpRichard MacCutchan9-Apr-13 4:58 
Questionhow to add list item dynamically in java I/O PinmemberMember 824369330-Mar-13 3:30 
AnswerRe: how to add list item dynamically in java I/O PinmvpRichard MacCutchan30-Mar-13 6:18 
GeneralRe: how to add list item dynamically in java I/O PinmemberMember 824369330-Mar-13 22:54 
GeneralRe: how to add list item dynamically in java I/O PinmvpRichard MacCutchan31-Mar-13 5:50 
GeneralRe: how to add list item dynamically in java I/O PinmemberMember 824369331-Mar-13 5:58 
GeneralRe: how to add list item dynamically in java I/O PinmvpRichard MacCutchan31-Mar-13 6:01 
GeneralRe: how to add list item dynamically in java I/O PinmemberMember 824369331-Mar-13 6:03 
GeneralRe: how to add list item dynamically in java I/O PinmvpRichard MacCutchan31-Mar-13 6:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 16 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid