Java Inventory Program 1-3

Download .pdf, .docx, .epub, .txt
Did you like this example?

Instructions: This document contains the tutorials for Inventory programs 1-3. These programs will be separated by pages between each program in addition to being color coded. NOTE: This information will need to be copy and pasted into a notepad document. For your own benefit, please do not plagiarize this work. // Inventory program part 1 Inventory1. java // // A product class that stores and makes the name of the product, the item number, the number of units in stock, and the price of each unit retrievable. // Java app. that displays the product name, the item number, price of each unit, and the value of inventory. mport java. util. Scanner; import java. text. NumberFormat; import java. text. DecimalFormat; class Product { private String name; // product name private int number; // product part number private double price; // product unit price private int quantity; // products in stock public Product(String N, int Num, double P, int Q) // Constructor { name = N; number = Num; price = P; quantity = Q; } // Getters and setters public void setName(String N) // method to set product name { name = N; } public String getName() // method to get product name { return name; } ublic void setNumber(int Num) // method to set part number { number = Num; } public int getNumber() // method to get part number { return number; } public void setPrice(double P) // method to set unit price { price = P; } public double getPrice() // method to get unit price { return price; } public void setQuantity(int Q) // method to set product quantity { quantity = Q; } public int getQuantity() // method to get product quantity { return quantity; } public double getTotalPrice() // return the total value of the inventory { double TotalPrice = quantity * price; eturn TotalPrice; } } // End class product public class Inventory1 { // starts execution of Inventory program public static void main(String args[]) { // create Scanner to obtain input from command window Scanner input = new Scanner(System. in); // create NumberFormat to obtain input from command window NumberFormat currency = new DecimalFormat(“u00A4 #. 00”); System. out. println(); // outputs a blank line System. out. print(“Enter the name of the product: “); // prompt for name of product String N = input. nextLine(); // read product name from user System. out. println(); // outputs a blank line System. out. println(); // outputs a blank line System. out. print(“Enter the product number for the product: “); // prompt for product number int Num = input. nextInt(); // read product number from user System. out. println(); // outputs a blank line System. out. println(); // outputs a blank line System. out. print(“Enter the unit price for the product: $ “); // prompt for unit price double P = input. nextDouble(); //read product unit price from user System. out. println(); // outputs a blank line System. out. rintln(); // outputs a blank line System. out.

Do you want to see the Full Version?

View full version

Having doubts about how to write your paper correctly?

Our editors will help you fix any mistakes and get an A+!

Get started
Leave your email and we will send a sample to you.
Thank you!

We will send an essay sample to you in 2 Hours. If you need help faster you can always use our custom writing service.

Get help with my paper
Sorry, but copying text is forbidden on this website. You can leave an email and we will send it to you.