Results 1 to 10 of 10

Thread: help in

  1. #1
    aussi is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default help in

    Hi everyone, could any one help me solving my problem
    actually it's assignment & i'm new in java i can't solve it
    i have been asked to develope java console program,, this program to manage a vegie fruit shop
    1-enter the name of product
    2 weight of it
    3 price per kilo
    4-enter the discount if not enter zero
    i must use BufferedReader
    Plz guys i am waiting 4 help
    Last edited by aussi; 11-25-2010 at 07:12 AM.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    So what you've done so far? This is a forum, not a place to get done your assignments. So you've to show some effort here.

  3. #3
    aussi is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default

    Java Code:
    //import java.io.BufferedReader;
    //import java.io.InputStreamReader;
    import java.io.*;
    import java.lang.*;
    import java.text.*;
    
    public class FruitVegShop {
    	public static void main (String[]args) throws IOException {
    		String name= ("Banana");
    double wieghtOfProduct=1.3;
    double PricePerKilogram=2.5;
    double DiscountForStudentStaff=1;
    double Total=wieghtOfProduct *PricePerKilogram;
    
    		BufferedReader Keyboardln=new BufferedReader(new InputStreamReader (System.in));
    			System.out.println("Please enter the name of product ..");
    		name=Keyboardln.readLine();
    		System.out.println("The name of product is "+ name);
    
    		System.out.println("Please enter Wieght Of Product..");
    		 wieghtOfProduct=Double.parseDouble(Keyboardln.readLine());
    		System.out.println("The weight of product is"+ wieghtOfProduct);
    
    		System.out.println("Please enter the price per kilogram..");
    		PricePerKilogram=Double.parseDouble(Keyboardln.readLine());
    		System.out.println("The price per kilogram"+ PricePerKilogram);
    
    		Total=Double.parseDouble(Keyboardln.readLine());
    		System.out.println("The Total="+Total);
    
    
    
    	System.out.println("The product name is ,,"+ name+" The weight of Product is "+wieghtOfProduct+"The discount is"+DiscountForStudentStaff+"The Total purchase is"+Total+".");
    
    	}
    
    }//end class
    that what i've done
    Last edited by Eranga; 11-25-2010 at 07:35 AM. Reason: code tags added

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Please use code tags next time, for posting code segments. Unformated codes are rally hard to read. If you don't know how to do it, check my forum signature.

    Lets look at your question. :)

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Your first task it to enter the product name. Do you want to select it from a list, or user can enter anything they wish?

  6. #6
    aussi is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default

    the users can enter anything they want

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  8. #8
    aussi is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default

    if fact i cant do the arthmatic operation .finally doesnt give me the total and the discount?!!

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by aussi View Post
    if fact i cant do the arthmatic operation .finally doesnt give me the total and the discount?!!
    Ok, for the moment just forget about the coding part. Take a piece of paper and write down how you solve these problems in basic maths. Later we can put them into the code.

  10. #10
    Join Date
    Jul 2010
    Location
    India
    Posts
    58
    Rep Power
    0

    Default

    Hi sorry to bump in but aussi can you pls tell me which part of code deals with the step

    enter the discount if not enter zero

    OK leave the code part ... Making the process simpler can you just describe how you calculate "Total purchase Amount" when given with parameters

    Weight
    Price/Kg
    Discount


    warm regards
    Vinod M
    ____________________________
    Give me beans .........

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •