any ideas on what I'm doing wrong? Thanks
~B
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package problem313;
/**
*
* @author TheGales
*/
public class Problem313
{
/**
* @param args the command line arguments
*/
// TODO code application logic here
private String partNumber;
private String partDescription;
private int partQuantity;
private double partCost;
private double invoiceAmount;
private double total;
private double x = partCost;
private int y = partQuantity;
public void setTotal(double partCost, int partQuantity)
{
total = partCost * partQuantity;
}
public double getTotal()
{
return total;
}
public void setPartNumber (String newNumber)
{
partNumber = newNumber; // store part number
}
public String getPartNumber ()
{
return partNumber;
}
public void setPartDescription (String newDescription)
{
partDescription = newDescription;
}
public String getPartDescription()
{
return partDescription;
}
public void setPartQuantity(int newQuantity)
{
partQuantity = newQuantity;// store part quantity
}
public int getPartQuantity()
{
if (partQuantity <=0 )
return (partQuantity = 0);
else
return partQuantity;
}
public void setPartCost(double newCost)
{
partCost = newCost;
}
public double getPartCost()
{
if (partCost <=0)
return (partCost = 0);
else
return partCost;
}
//display an invoice message
public void displayMessage()
{
System.out.println("Welcome to the Hardware Invoice");
}
public void displaygetInvoiceAmount()
{
invoiceAmount = (partCost * partQuantity);
System.out.printf("Invoice Total: "+ invoiceAmount);
}// end of method
}//end of class
here is the rest of the code
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package problem313;
import java.util.Scanner;
/**
*
* @author TheGales
*/
public class Problem313Test
{
private static String partNumber;
private static String newNumber;
private static String partDescription;
private static String newCost;
private static String partQuantity;
private static String newQuantity;
private static String partCost;
public static void Problem313 (String args[])
{
Problem313 invoice = new Problem313();
Scanner input = new Scanner (System.in);//
System.out.println("Welcome to Hardware invoice:");// intro to invoice
System.out.println("Enter Part Number: "); //Prompt user to input part number data
partNumber = input.nextLine();
invoice.setPartNumber(newNumber);
System.out.println();
System.out.println("Enter Part Descripiton: "); //Prompt user to input part description data
partDescription = input.nextLine();
invoice.setPartNumber(newCost);
System.out.println();
System.out.println("Enter Part Quantity: "); //Prompt user to input part numebr data
partQuantity = input.nextLine();
invoice.setPartNumber(newQuantity);
System.out.println();
System.out.println("Enter Part Cost: "); //Prompt user to input part numebr data
partCost = input.nextLine();
invoice.setPartNumber(newCost);
System.out.println();
invoice.displayMessage();
invoice.displaygetInvoiceAmount();
}
}

New Topic/Question
Reply




MultiQuote



|