Click here to Skip to main content
15,886,806 members
Home / Discussions / Java
   

Java

 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan9-Apr-13 9:40
mveRichard MacCutchan9-Apr-13 9:40 
GeneralRe: Read JNDI from c# Pin
Member 111849410-Apr-13 22:55
Member 111849410-Apr-13 22:55 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan10-Apr-13 23:14
mveRichard MacCutchan10-Apr-13 23:14 
GeneralRe: Read JNDI from c# Pin
Member 111849410-Apr-13 23:21
Member 111849410-Apr-13 23:21 
GeneralRe: Read JNDI from c# Pin
Richard MacCutchan11-Apr-13 0:38
mveRichard MacCutchan11-Apr-13 0:38 
GeneralRe: Read JNDI from c# Pin
Member 111849411-Apr-13 0:42
Member 111849411-Apr-13 0:42 
SuggestionRe: Read JNDI from c# Pin
Prasad Khandekar2-May-13 19:49
professionalPrasad Khandekar2-May-13 19:49 
QuestionJava Program to accept input from user and then display output . Pin
Aman kumar routh4-Apr-13 3:35
Aman 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 . Pin
emadrefai4-Apr-13 6:20
emadrefai4-Apr-13 6:20 
GeneralRe: Java Program to accept input from user and then display output . Pin
Aman kumar routh4-Apr-13 6:29
Aman kumar routh4-Apr-13 6:29 
AnswerRe: Java Program to accept input from user and then display output . Pin
Richard MacCutchan4-Apr-13 6:29
mveRichard MacCutchan4-Apr-13 6:29 
QuestionJAVA Pin
Member 995424830-Mar-13 8:01
professionalMember 995424830-Mar-13 8:01 
AnswerRe: JAVA Pin
Richard MacCutchan30-Mar-13 13:19
mveRichard MacCutchan30-Mar-13 13:19 
AnswerRe: JAVA Pin
Shubhashish_Mandal1-Apr-13 2:43
professionalShubhashish_Mandal1-Apr-13 2:43 
AnswerRe: JAVA Pin
Cesar Bretana Gonzalez3-Apr-13 9:43
professionalCesar Bretana Gonzalez3-Apr-13 9:43 
AnswerRe: JAVA Pin
Aman kumar routh4-Apr-13 3:46
Aman kumar routh4-Apr-13 3:46 
AnswerRe: JAVA Pin
Richard MacCutchan9-Apr-13 4:58
mveRichard MacCutchan9-Apr-13 4:58 
Questionhow to add list item dynamically in java I/O Pin
Member 824369330-Mar-13 3:30
Member 824369330-Mar-13 3:30 
AnswerRe: how to add list item dynamically in java I/O Pin
Richard MacCutchan30-Mar-13 6:18
mveRichard MacCutchan30-Mar-13 6:18 
GeneralRe: how to add list item dynamically in java I/O Pin
Member 824369330-Mar-13 22:54
Member 824369330-Mar-13 22:54 
GeneralRe: how to add list item dynamically in java I/O Pin
Richard MacCutchan31-Mar-13 5:50
mveRichard MacCutchan31-Mar-13 5:50 
GeneralRe: how to add list item dynamically in java I/O Pin
Member 824369331-Mar-13 5:58
Member 824369331-Mar-13 5:58 
GeneralRe: how to add list item dynamically in java I/O Pin
Richard MacCutchan31-Mar-13 6:01
mveRichard MacCutchan31-Mar-13 6:01 
GeneralRe: how to add list item dynamically in java I/O Pin
Member 824369331-Mar-13 6:03
Member 824369331-Mar-13 6:03 
GeneralRe: how to add list item dynamically in java I/O Pin
Richard MacCutchan31-Mar-13 6:06
mveRichard MacCutchan31-Mar-13 6:06 

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

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