Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2014
    Posts
    4
    Rep Power
    0

    Default I want to develop a this type of program in core java im not understanding how to sta

    You have to write store price calculation logic. It takes input as item details like name , price etc and prints back
    the total price with summary.
    There is -
    - 10% discount in cloths
    - 20% in stationary
    at the moment which system calculates internally, so this also needs to be accounted. Please make other
    assumptions that is required for this program.

    Input :
    Item Name , Quantity and Price as Input
    Example:
    Enter Item Name: White Shirt
    Enter Quantity:1
    Enter Item Price: 500 Rs
    Enter Item Name: Cup Set
    Enter Quantity:1
    Enter Item Price: 200 Rs
    Enter Item Name: Notebook
    Enter Quantity:2
    Enter Item Price: 40 Rs
    Enter Item Name: Toy
    Enter Quantity:3
    Enter Item Price: 60 Rs
    Output:
    number - Item - Quantity - Price
    -------------------------------
    1.) White Shirt - 1- 500 Rs
    discount 10% - 50 Rs
    2.) Cup set - 1- 200 Rs
    3.) Notebook - 2 - 80 Rs
    discount 20% -16 Rs
    4.) Toy - 3 - 180 Rs
    --------------------------------
    Total: 894 Rs
    Total Discount: 66 Rs
    Last edited by Norm; 07-07-2014 at 11:34 PM. Reason: emai addressl removed

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,001
    Rep Power
    10

    Default Re: I want to develop a this type of program in core java im not understanding how to

    Did you have a question then?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Join Date
    Jul 2014
    Posts
    4
    Rep Power
    0

    Default Re: I want to develop a this type of program in core java im not understanding how to

    I need a code how to develop

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,122
    Rep Power
    20

    Default Re: I want to develop a this type of program in core java im not understanding how to

    This is not a code factory.
    You need to try and produce code and then ask questions about the code you've written.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    Join Date
    Jul 2014
    Posts
    4
    Rep Power
    0

    Default Re: I want to develop a this type of program in core java im not understanding how to

    give me the reply friend

    Java Code:
    import java.util.*;
    class ShopMarket
    {
    	String iname;
    	int quantity,price,total;
    	Scanner s = new Scanner(System.in);
    	void getDetails()
    	{
    		System.out.println("Enter Item Name:");
    		iname=s.next();
    		
    		System.out.println("Enter Quantity:");
    		quantity=s.nextInt();
    	
    		System.out.println("Enter Item Price:");
    		price=s.nextInt();
    		
    	}
    	void display()
    	{
    		total=price*quantity;
    		System.out.println(iname+"\t\t"+quantity+"\t"+ price+"\t"+total);
    		
    	}
    }
    
    
    
    
    
    import java .util.Scanner;
    class ShopMarketTest 
    {
    	public static void main(String[] args) 
    	{
    		Scanner input=new Scanner(System.in);
    		int n;
    		ShopMarket s1=new ShopMarket();
    		System.out.println("How Many Item Do You Want TO Insert:");
    		n=input.nextInt();
    		for(int i=0;i<=n;i++)
    		s1.getDetails();
    		
    		System.out.println("Item Name Quantity    Price    Total");
    		
    		s1.display();
    	}
    }
    Last edited by nikhilbalkhande; 07-08-2014 at 05:59 PM.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: I want to develop a this type of program in core java im not understanding how to

    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE GOES HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,122
    Rep Power
    20

    Default Re: I want to develop a this type of program in core java im not understanding how to

    Quote Originally Posted by nikhilbalkhande View Post
    give me the reply friend
    And?
    What exactly is wrong with your code?
    What errors are you getting?

    What are you stuck on?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    844
    Rep Power
    6

    Default Re: I want to develop a this type of program in core java im not understanding how to

    I have seen 2 logical issues in your code

    1. In for loop you used i < =n .In this case if i supply no of quanties 2 starting with 0 it will ask the user to input 3 items..got it? so make i < n.

    2. Another issue is you are not printing all the items what user keyed in ...include all inside ur loop
    Ramya:cool:

  9. #9
    Join Date
    Jul 2014
    Posts
    4
    Rep Power
    0

    Default Re: I want to develop a this type of program in core java im not understanding how to

    k sir but i m not understand how to hold data from getting from user and display on console you understand what i want to say. i m not understsand how to hold data by using scanner i m holding 1 type of data but i want 2 or 3 value want to hold how it is possible please tell me

  10. #10
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    844
    Rep Power
    6

    Default Re: I want to develop a this type of program in core java im not understanding how to

    u just wrap the code inside for loop like this for maintaining the values.I have explained u already.

    Java Code:
    for(int i=0;i< n;i++)
    {
            s1.getDetails();
             
            System.out.println("Item Name Quantity    Price    Total");
             
            s1.display();
        }
    Ramya:cool:

Similar Threads

  1. Replies: 0
    Last Post: 09-19-2013, 02:04 PM
  2. Need help for a program in Core Java
    By Sailendra in forum New To Java
    Replies: 5
    Last Post: 03-07-2013, 11:42 AM
  3. Understanding limitations of int data-type
    By JONCOM in forum New To Java
    Replies: 11
    Last Post: 01-30-2011, 10:57 PM
  4. Develop chat program using SCTP protocol
    By rams in forum Networking
    Replies: 0
    Last Post: 11-03-2008, 06:07 AM
  5. Replies: 5
    Last Post: 11-02-2008, 08:58 PM

Posting Permissions

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