Create a class named TestInvoice whose Main() method declares Three Invoice items. Create a method that prompts the user for and accepts values for the item number, name, quantity, and price for each Invoice. Then Display each completed object. Save the application as TestInvoice.java
Code for Invoice:
import java.util.Scanner;
public class Invoice
{
public static void main (String args[])
{
int itemnum, quantitynum, totalcost;
int price;
String itemname;
Scanner input = new Scanner(System.in);
System.out.println("Please enter the items name");
itemname = input.next();
System.out.println("Please enter the items id");
itemnum = input.nextInt();
System.out.println("Please enter the items cost");
price = input.nextInt();
System.out.println("Please enter the amount of items you would like manufactured");
quantitynum = input.nextInt();
totalcost = (price*quantitynum);
System.out.println("Item Name:" + itemname);
System.out.println("");
System.out.println("Item ID:" + itemnum);
System.out.println("");
System.out.println("Item Price:$" + price);
System.out.println("");
System.out.println("Items wanted:" + quantitynum);
System.out.println("");
System.out.println("Total Cost:$" + totalcost);
System.out.println("");
}
}