• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ViLeNT

#1
thank you ;) I fixed this


//********************************************************************
//  Invoice.java       Author: Vince Guadalupe
//
//  Creates a new invoice and calculates the customers total.
//
//********************************************************************

public class Invoice
{

//declares instance variables for: part number, part description, quantity of items, and price per item
private String partNumber, partDescription;
private int quantity;
private double pricePerItem;

//-----------------------------------------------------------------
//  Sets up the an invoice by defining the part number, part description,
//  the quantity of items and the price per item
//-----------------------------------------------------------------
public Invoice (String partNumber, String partDescription, int quantity, double pricePerItem)
   {
   this.partNumber = partNumber;
   this.partDescription = partDescription;
   this.quantity = quantity;
   this.pricePerItem = pricePerItem;
}

 
   //  Setter method for part number variable
   public void setpartNumber (String partNumber)
   {
   this.partNumber = partNumber;
   }

   //  Getter method for part number variable
   public String getpartNumber()
   {
      return partNumber;
   }
   
 
   //  Setter method for part description variable
   public void setpartDescription (String partDescription)
   {
   this.partDescription = partDescription;
   }

   //  Getter method for part description variable
   public String getpartDescription()
   {
      return partDescription;
   }
   
 
   //  Setter method for quantity variable
   public void setquantity (int quantity)
   {
   this.quantity = quantity;
   if(quantity < 0) {
   this.quantity = 0;
}
   }

   
   //  Getter method for quantity variable
   public int getquantity()
   {
     
   if(quantity < 0) {
   this.quantity = 0;
   }
   return quantity;
   }
   
   
   //  Setter method for price per item
   public void setpricePerItem (double pricePerItem)
   {
   this.pricePerItem = pricePerItem;
   if(pricePerItem < 0) {
   this.pricePerItem = 0.0;
}
   }


   //  Getter method for price per item
   public double getpricePerItem()
   {
   if(pricePerItem < 0) {
   this.pricePerItem = 0.0;
   }
      return pricePerItem;
   }

//calculates and returns the invoice amount
public double getinvoiceAmount()
{
return (quantity * pricePerItem);

}



} // end class Invoice

#2
Well I managed to get a little further.



//********************************************************************
//  Invoice.java       Author:
//
//  Creates a new invoice and calculates the customers total.
//
//********************************************************************

import java.text.*;

public class Invoice
{

//declares instance variables for: part number, part description, quantity of items, and price per item
private String partNumber, partDescription;
private int quantity;
private double pricePerItem;

//-----------------------------------------------------------------
//  Sets up the an invoice by defining the part number, part description,
//  the quantity of items and the price per item
//-----------------------------------------------------------------
public Invoice (String serial, String partDesc, int amount, double itemprice)
   {
   partNumber = serial;
   partDescription = partDesc;
   quantity = amount;
   pricePerItem = itemprice;
   }

 
   //  Setter method for part number variable
   public void setpartNumber (String partNumber)
   {
   }

   //  Getter method for part number variable
   public String getpartNumber()
   {
      return partNumber;
   }
   
 
   //  Setter method for part description variable
   public void setpartDescription (String partDescription)
   {
   }

   //  Getter method for part description variable
   public String getpartDescription()
   {
      return partDescription;
   }
   
 
   //  Setter method for quantity variable
   public void setquantity (int quantity)
   {
   }

   
   //  Getter method for quantity variable
   public int getquantity()
   {
      return quantity;
   }
   
   
   //  Setter method for price per item
   public void setpricePerItem (double pricePerItem)
   {
   }


   //  Getter method for price per item
   public double getpricePerItem()
   {
      return pricePerItem;
   }

//calculates and returns the invoice amount
public double getinvoiceAmount()
{
return (quantity * pricePerItem);

}



} // end class Invoice




public class Transaction
{
public static void main( String args[] )
{
Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );

// display invoice1
System.out.println( "Original invoice information" );

System.out.printf( "Part number:\n", invoice1.getpartNumber() );

System.out.printf( "Description: %s\n", invoice1.getpartDescription() );

System.out.printf( "Quantity: %d\n", invoice1.getquantity() );

System.out.printf( "Price: %.2f\n", invoice1.getpricePerItem() );

System.out.printf( "Invoice amount: %.2f\n", invoice1.getinvoiceAmount() );

System.out.println();

System.out.println("***** Testing for negative values");

// change invoice1's data
invoice1.setpartNumber("001234");

invoice1.setpartDescription( "Yellow Hammer");

invoice1.setquantity(-2);

invoice1.setpricePerItem(-5.95);

System.out.printf( "Invoice amount: %.2f\n", invoice1.getinvoiceAmount() );
}
}



Output:

Original invoice information
Part number: 1234
Description: Hammer
Quantity: 2
Price: 14.95
Invoice amount: 29.90

***** Testing for negative values
Invoice amount: 29.90
#3
Java Programming / Help: Creating a basic invoice
February 24, 2008, 10:05 PM
I've been working on this for the past 3-4 hours. I've made a lot of progress but it's clear much is to be done. Can someone please point me in the right direction as to why this is not working? ??? ???

Invoice.java


//********************************************************************
//  Invoice.java       Author:
//
//  Creates a new invoice and calculates the customers total.
//
//********************************************************************

import java.text.*;

public class Invoice
{

//declares instance variables for: part number, part description, quantity of items, and price per item
private String PartNumber, PartDescription;
private int Quantity;
private double PricePerItem;

//-----------------------------------------------------------------
//  Sets up the an invoice by defining the part number, part description,
//  the quantity of items and the price per item
//-----------------------------------------------------------------
public Invoice (String PartNumber,String PartDescription, int Quantity, double PricePerItem)
   {

   }

 
   //  Setter method for part number variable
   public void setPartNumber (String PartNumber)
   {
   }

   //  Getter method for part number variable
   public String getPartNumber()
   {
      return PartNumber;
   }
   
 
   //  Setter method for part description variable
   public void setPartDescription (String PartDescription)
   {
   }

   //  Getter method for part description variable
   public String getPartDescription()
   {
      return PartDescription;
   }
   
 
   //  Setter method for quantity variable
   public void setQuantity (int Quantity)
   {
   }

   
   //  Getter method for quantity variable
   public int getQuantity()
   {
      return Quantity;
   }
   
   
   //  Setter method for price per item
   public void setPricePerItem (double PricePerItem)
   {
   }


   //  Getter method for price per item
   public double getPricePerItem()
   {
      return PricePerItem;
   }

//calculates and returns the invoice amount
public double getInvoiceAmount()
{
double sum = Quantity * PricePerItem;

return sum;
}



} // end class Invoice



Transaction.java


public class Transaction
{
public static void main( String args[] )
{
Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );

// display invoice1
System.out.println( "Original invoice information" );

System.out.printf( "Part number: %s\n", invoice1.getPartNumber() );

System.out.printf( "Description: %s\n",

invoice1.getPartDescription() );

System.out.printf( "Quantity: %d\n", invoice1.getQuantity() );

System.out.printf( "Price: %.2f\n", invoice1.getPricePerItem() );

System.out.printf( "Invoice amount: %.2f\n",

invoice1.getInvoiceAmount() );

System.out.println();

System.out.println("***** Testing for negative values");

// change invoice1's data
invoice1.setPartNumber( "001234" );

invoice1.setPartDescription( "Yellow Hammer" );

invoice1.setQuantity( -2 );

invoice1.setPricePerItem( -5.95 );

System.out.printf( "Invoice amount: %.2f\n",
invoice1.getInvoiceAmount() );
}
}




Additionally I am missing the following:

With respect to quantity of the item and price per item, create this rule

•If the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0.0.


----------------------------------------------------------------------

Right now when I run the program I am getting the following output:

Original invoice information
Part number: null
Description: null
Quantity: 0
Price: 0.00
Invoice amount: 0.00

***** Testing for negative values
Invoice amount: 0.00
#4
Java Programming / Re: BASIC PROGRAM PLEASE HELP!!
February 06, 2008, 11:08 PM
correct ;) we haven't got that far yet
#5
Java Programming / Re: BASIC PROGRAM PLEASE HELP!!
February 01, 2008, 08:44 AM
thank you ;) I got it to work just fine



//********************************************************************
//  Five.java      Author:
//
//  Program breaks apart a five-digit number.
//********************************************************************

package assignment2;

import java.util.Scanner;

public class Five
{
//-----------------------------------------------------------------
//  Prompts user to enter a five-digit number then outputs tab spaces between each digit.
    //-----------------------------------------------------------------
public static void main( String args[] )
{
String digits;

Scanner scan = new Scanner (System.in);

System.out.print ("Please enter a five digit number: ");
 
digits = scan.nextLine();

  String n1 = digits.substring(0,1) ;
      String n2 = digits.substring(1,2) ;
      String n3 = digits.substring(2,3) ;
      String n4 = digits.substring(3,4) ;
      String n5 = digits.substring(4,5) ;

   System.out.println (n1+ "\t" + n2+ "\t" + n3+ "\t" + n4+ "\t" + n5+ "\t");



} // end main
} // end class Five


#6
Java Programming / BASIC PROGRAM PLEASE HELP!!
February 01, 2008, 02:11 AM
Basically I am to create a program that does the following.

Prompt a user to input a 5 digit value.

When the user inputs a value such as 12345 and hits enter

the program should put tabs inbetween each individual digit

such as 1  2  3  4  5


I cannot find this out for the life of me......heres sort of what I have I know its wrong but if someone could please edit my code and bold what they've changed I WOULD APPRECIATE IT!!


heres the only encouragement my teacher has provided...


There are two ways to do it, either treat user input as string and use substring method to get individual digits.



Other way is to treat user input as a number, and perform division and remainder operations on it to get required digits




Heres is my code



//********************************************************************
//  Five.java      Author:
//  Program breaks apart a five-digit number.
//********************************************************************

package assignment2;

import java.util.Scanner;

public class Five
{
    //-----------------------------------------------------------------
    //  Prompts user to enter a five-digit number then outputs tab spaces between each digit.
    //-----------------------------------------------------------------
public static void main( String args[] )
{
String digits;

Scanner scan = new Scanner (System.in);

System.out.print ("Please enter a five digit number: ");
 
digits = scan.nextLine();

System.out.println (n1+ "\t" + n2+ "\t" + n3+ "\t" n4+ "\t"n5+ "\t");



} // end main
} // end class Five

#7
figured this out on my own
#8
I have Java 6 Update 4 installed on my computer as well as Eclipse Classic 3.3.1 (both downloaded and installed today)

When I go to Run -- > Run As inside Eclipse it shows (None Applicable)


can anyone tell me why this is and how to fix this? I cannot run anything :(! Seems as if its not detecting my Java
#9
C/C++ Programming / Re: Compile Error!
October 10, 2007, 09:39 PM
do you recommend any specific compiler? or can you be more specific and tell me what im doing wrong?

im currently using a shitty generic compiler the school provided.
#10
C/C++ Programming / Compile Error!
October 10, 2007, 09:31 PM
Can someone please look at this code.

When I try to compile it I get a scrolling list of errors.

If someone could modify it and repost it.....or tell me what im doing wrong I would appreciate it!



#include <stdio.h>


void getInput(int *pNum1, int *pNum2);
void calc(int num1, int num2, int *pSum, int *pDivint, int *pRemdiv, double *pHal1, double *pHal2, double *pQuot, int *pModeqn);
void intOps(int num1, int num2, int *pSum, int *pDivint, int *pRemdiv);
void doubleOps(int num1, int num2, double *pHal1, double *pHal2, double *pQuot);
int algebra(int num1, int num2);               
void display(int num1, int num2, int sum, int divint, int remdiv, double hal1, double hal2, double quot, double modeqn);

int main(void)
{
printf("\nName: Jai Jensen");

int num1, num2, sum, divint, remdiv, modeqn;
double hal1, hal2, quot, modeqn;


getInput(&num1, &num2);
calc(int num1, int num2, &sum, &divint, &remdiv, &hal1, &hal2, &quot, &modeqn);
display(num1, num2, sum, divint, remdiv, hal1, hal2, quot, modeqn);

return 0;
}

// Prompts User for Input
void getInput(int* pNum1, int* pNum2
{
printf("\Please enter two numbers: ");
scanf("%d %d", pNum1, pNum2);
}

// Funtions for operations
viod calc(int num1, int num2, int *pSum, int *pDivint, int *pRemdiv, double *pHal1, double *pHal2, double *pQuot, int *pModeqn);
{
intOps(num1, num2, pSum, pDivint, pRemdiv);
doubleOps(num1, num2, pHal1, pHal2, pQuot);
*pModeqn = algebra(num1, num2)
}

// Furntions for integer opterations
void calcintOps(int num1, int num2, int *pSum, int *pDivint, int *pRemdiv);
{
*pSum = num1 * num2;
        *pDivint = num1/num2;
        *pRemdiv = num1 % num2;
}

// Functions for double operations
void calcdoubleOps(int num1, int num2, double *pHal1, double *pHal2, double *pQuot);
{
*pHal1 = .5 * num1;
        *pHal2 = .5 * num2;
        *pQuot = (1.0 * num1)/ (num2);
}

// Function for answering equation
int algebra(int num1, int num2);
{
int pModeqn;
pModeq = (2 * num1) + (4 * num2) + (num1 * num2) - (num1/num2);
return pModeqn;
}

//Display
void display(int num1, int num2, int sum, int divint, int remdiv, float hal1, float hal2, float quot, float modeqn);
   
   printf("\n%20s%20s", "Description", "Data");
   printf("\n%20s%20s", "-----------", "----");
   printf("\n%20s%20d", "Input 1", num1);
   printf("\n%20s%20d", "Input 2", num2);
   printf("\n%20s%20d", "Sum", sum);
   printf("\n%20s%20.1f", "1/2 Input 1", hal1);
   printf("\n%20s%20.1f", "1/2 Input 2", hal2);
   printf("\n%20s%20d", "Division", divint);
   printf("\n%20s%20d", "Remainder", remdiv);
   printf("\n%20s%20.4f", "Quotient", quot);
   printf("\n%20s%20.3f", "2x + 4y + xy + x/y", modeqn);
   printf("\n\n");

   return 0;
}


#11
Well...we are all still alive ;)


Carry on children ;D


Maybe now after going over protocols, dumb fuckers wont load 6 nuclear warheads onto a plane "without even knowing what they are carrying"
#14
awful blizzard basically slapped us in the face with this.........they made it "POSSIBLE" for anyone to create a league...yeah IF...IF you know MySQL, HTML, PHP, PHOTSHOP...to say the least......you basically have to have a setup like WGT to accomplish a league.....might as well of limited it to WGT instead of making it sound so easy and user friendly when it actuality it is not
#15
Web Development / Inserting WebChannel
March 17, 2007, 01:35 PM
What's the code to insert my channel list into a table on my site (http://www.teamsoulz.net)

Here's channel listing: http://www.valhallalegends.com/skywing/isapi/BinaryChatISAPI.dll?channellistex=TeamSoulz


Also how do I go about this... "When addressing BinaryChatISAPI.dll, add a css query which value is the web address of your custom style sheet."

I'd like to create a new .css to match my team site, can someone post an example link of how I would add my new css query?