Nitewalkr's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
171 (0.12 per day)
Joined:
17-November 10
Profile Views:
4,999
Last Active:
User is offline Oct 29 2014 01:00 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Nitewalkr has not set their status

Posts I've Made

  1. In Topic: Compilers

    Posted 27 Oct 2014

    Define the part "whatever little future there is." If there is very little little future to no future for APIs using java, then what language should I persue? I thought if I learn java thoroughly I would be able understand pretty much all the programming languages.

    Also the reason I put all of that in one thread is because I didn't want to spam threads for different topics since they are relevant to each other. Integrated Development Environments comparison along with API frameworks like jframe, jpanels, not the frameworks like .net. and compilers (I will have to read up on these before I bring them to discussion,) but currently I am working in Eclipse mainly in java. I raised this discussion to know what tool besides notepad++, eclipse and vs, does the majority use for coding and or building the GUIs.
  2. In Topic: Programming with a learning disorder

    Posted 27 Oct 2014

    Perhaps a little late to the discussion but I found this.

    If its a matter of learning, I would suggest reading constantly to ease up the struggle of understanding. (Ya that just came out offensive, I apologize.) Its the only way to get past the NVLD.

    If later on in few months you dont see any improvements, I would suggest you go to youtube and learn through video tutorials.
  3. In Topic: Java Loop Issue

    Posted 25 Oct 2014

    Hi there;

    So I have figured it out;

    Invoice class

    import java.util.Scanner;
    
    public class Invoice 
    {
    	private String partNumber, partDescription;
    	private int Qty;
    	private double ItemPrice;
    	
    	public Invoice(String partNum, String partDesc, int initQty, double price)
    	{
    		partNumber = partNum;
    		partDescription = partDesc;
    		//initializing qty
    		if(initQty > 0)	{Qty = initQty;}
    		else if (initQty < 0) {Qty = 0;}
    		//initializing price
    		if(price > 0.0 ){ItemPrice = price;}
    		else if (price < 0.0) {ItemPrice = 0.0;}
    		
    	}
    	//set methods Parts
    	public void setParts(String partNum, String partDesc)
    	{
    		partNumber = partNum;
    		partDescription = partDesc;
    	}
    	//set method for quantity
    	public void setQty(int qty_itemPurchased)
    	{
    		//quantity minus the quantity purchased
    		Qty -= qty_itemPurchased;
    		//if quantity <= 0 Qty = 0
    		if(qty_itemPurchased <= 0)
    		{
    			Qty = 0;
    		}
    			
    	}
    	//set price
    	public void setPrice(double price)
    	{	ItemPrice = price;	}
    		
    	//get methods for parts
    	public String getPartNumber(){return partNumber;}
    	public String getPartDesc(){return partDescription;}
    	public int getQty(){return Qty;}
    	public double getPrice(){return ItemPrice;}
    
    	//calculation and condition
    	public void getInvoiceAmount()
    	{
    		int qtyMinus;
    		double totprice;
    			@SuppressWarnings("resource")
    			Scanner sc = new Scanner(System.in);
    			System.out.print("\nEnter the quantity of parts:");
    			qtyMinus = sc.nextInt();
    			//conditions
    			if (qtyMinus <= 0)
    			{	System.out.print("\nInvalid quantity\n\n");	}
    			else if(qtyMinus > Qty)
    			{	System.out.print("\nYou have exceeded the amount of quantity\n\n");	}
    			else if(Qty == 0)
    			{	System.out.print("\nOut of Stock\n\n");	}
    			//calculation
    			else
    			{
    				totprice = getPrice() * qtyMinus;
    				Qty = Qty - qtyMinus;
    				System.out.printf("Quantity: %d price: $%.02f\n\n",qtyMinus,totprice);
    			}
    			
    	}
    }
    
    
    
    


    Main
    /*
     * Issue: When you get the price it calculates the remaining
     *  quantity not the quantity the user has asked for.
     * 
     */
    import java.util.Scanner;
    public class InvoiceTest 
    {
    	public static void main (String[] args)
    	{
    		//declare boolean and char for the loop
    		boolean y = false;
    		char x;
    		//create an object of a class invoice with 4 params
    		Invoice invoice1 = new Invoice("ì7-4770","Intel Chip",50 ,450.00);
    		//object of Scanner
    		@SuppressWarnings("resource")
    		Scanner sc = new Scanner(System.in);
    		//Display the initial stock with part number part desc Qty and price
    		System.out.printf("Part Number: %s Part Description: %s"
    				+ " Quantity: %d Price: $%.2f\n",invoice1.getPartNumber(),
    				invoice1.getPartDesc(),invoice1.getQty(),invoice1.getPrice());
    		//do while true
    		do
    		{
    			//use input
    			System.out.printf("\nWould you like to make an invoice?(Y/N): ");
    			x = sc.next().charAt(0);
    			Character.toUpperCase(x);
    			//if y, execute this function getInvoiceAmount();
    			if( x == 'y')
    			{
    				invoice1.getInvoiceAmount();
    
    				System.out.printf("Part Number: %s Part Description: %s"
    						+ " Quantity: %d Price: $%.2f\n",invoice1.getPartNumber(),
    						invoice1.getPartDesc(),invoice1.getQty(),invoice1.getPrice());
    			}
    			
    			else if( x == 'n')
    			{
    				System.out.print("\nThank you for using Home hardware Invoice system\n");
    				y = false;
    				break;
    			}
    			y = true;
    		}
    		while(y == true);
    
    						
    		
    		
    		
    		//System.out.print(" Quantity: " +invoice1.getQty());
    		//System.out.printf("\nPart Number: %s Part Description: %s Quantity: " + invoice1.getQty() + 
    			//	" Price: $%.2f\n",invoice1.getPartNumber(),invoice1.getPartDesc(),invoice1.getPrice());
    		
    		
    	}
    
    }
    
    
    


    I really didnt have to do anything except for displaying the message stating "invalid amount" x.x

    Wow!! Talk about being stuck on retarded mistake for hours and then being dumb founded when you realize it was a stupid mistake.
  4. In Topic: New to Arrays

    Posted 24 Oct 2014

    View PostKesto, on 24 October 2014 - 09:29 AM, said:

    i give up. thanks anyways guys


    You dont have to give up on this just because you cant understand it. I apologize for intruding but its better if you do it in psudocode before you actually write anything.

    That way you will be able to understand it yourself. I dont use Array's much but here goes. (correct me if I am wrong.)

    my psudocode:

    -You have first line of boxes containing flower in one isle
    -You have second line of boxes that has price written on it in the second isle.
    -You want to create a loop that maxes out prior to the types of the boxes per line.
    -use one for loop to count them.
    -display the flowers and cost.

    so this is what you will end up with.
    (I am not sure if I am going to get a warning for this.)

    //import java.util.Scanner;
    
    public class myArray 
    {
    
    	public static void main(String[] args) 
    	{
    		//Scanner sc = new Scanner(System.in);
    		
                        //first line of boxes in one isle
    		    String [] flowers = new String[] {"petunias", "pansy", "rose", "violet", "carnation"};
                        //second line of boxes in the second isle
    		    double [] cost = new double[] {.50, .75, 1.50, .50, .80};
    		    // i refers to myIndex or Index.
                        int i;
    		  //int j;
    		    //for loop while Index is at 0 and if it is less then the types of flowers you have in the array, increase Index by one.
    		    for(i=0; i<flowers.length; i++)
    		    {
    		    	//System.out.print(flowers[i]);
    		    	//System.out.print(cost[j]);
                            //display
    		    	System.out.printf("Flowers:%s  Price:$%.02f\n", flowers[i], cost[i]);	
    		    }
    	}
    
    }
    


    Output:

    Flowers:petunias Price:$0.50
    Flowers:pansy Price:$0.75
    Flowers:rose Price:$1.50
    Flowers:violet Price:$0.50
    Flowers:carnation Price:$0.80



    So, you still have to ask the user using the scanner.

    EDIT1: like sir Mac said; A break does us all good sometimes.
    EDIT2: Disregard the commented code in the code block.
  5. In Topic: Getting "around" static?

    Posted 23 Oct 2014

    Why are you trying to call a set method?

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Comments

Page 1 of 1
  1. Photo

    Alex6788 Icon

    24 Nov 2010 - 10:12
    Hi new friend.
Page 1 of 1