I am trying to write a simple Java program which calculates the invoice amount for parts ordered from a hardware store. Once I compile it through the command prompt, I receive "Invoice.java:17: error: '.class' expected return int invoiceAmount;"
Did I miss an identifier somewhere? I've tried adding datatypes and new methods to instantiate and display the invoiceAmount again, but that did not seem to work. Any advice would be much appreciated. Thanks in advance!
//Invoice for hardware store
import java.util.Scanner;
public class Invoice {
public static void setInvoice(String[] args) {
String partNumber;
String partDescription;
double price;
Scanner amountPurchased = new Scanner(System.in);
}
public double getInvoiceAmount(){
return int invoiceAmount;
}
private void setInvoice(int amountPurchased){
int amountPurchased;
// get quantity of item from user input
System.out.println("Please enter quantity of item purchased: ");
amountPurchased = amountPurchased.nextInt( );
// get item price from user input
System.out.println("Please enter single unit item price: ");
Scanner price = new Scanner(System.in);
//multiplies quantity by price per item
invoiceAmount = amountPurchased * price;
}
}