Answer to Question #243679 in Java | JSP | JSF for ssmi

Question #243679

Create a class called ItemQuantity to represent a item and the quantity * the quantity is a positive number.


1
Expert's answer
2021-09-28T11:42:51-0400
class Item {
	// part description (type String)
	private String partDescription;
	// a part type of item (type String)
	private String partType;
	// a part price (type double)
	private double partPrice;
	// a part year of production (type int)
	private int partYear;
	// a part capacity of the item (type String)
	private String partCapacity;
	// a part processing (type String)
	private String partProcessing;


	/**
	 * A constructor that initializes the instance variables.
	 * 
	 * @param partDescription
	 * @param partType
	 * @param partPrice
	 * @param partYear
	 * @param partCapacity
	 * @param partProcessing
	 */
	public Item(String partDescription, String partType, double partPrice, int partYear, String partCapacity,
			String partProcessing) {
		this.partDescription = partDescription;
		this.partType = partType;
		this.partPrice = partPrice;
		this.partYear = partYear;
		this.partCapacity = partCapacity;
		this.partProcessing = partProcessing;
	}


	// Provide a set and a get method for each instance variable.
	/**
	 * @return the partDescription
	 */
	public String getPartDescription() {
		return partDescription;
	}


	/**
	 * @param partDescription the partDescription to set
	 */
	public void setPartDescription(String partDescription) {
		this.partDescription = partDescription;
	}


	/**
	 * @return the partType
	 */
	public String getPartType() {
		return partType;
	}


	/**
	 * @param partType the partType to set
	 */
	public void setPartType(String partType) {
		this.partType = partType;
	}


	/**
	 * @return the partPrice
	 */
	public double getPartPrice() {
		return partPrice;
	}


	/**
	 * @param partPrice the partPrice to set
	 */
	public void setPartPrice(double partPrice) {
		this.partPrice = partPrice;
	}


	/**
	 * @return the partYear
	 */
	public int getPartYear() {
		return partYear;
	}


	/**
	 * @param partYear the partYear to set
	 */
	public void setPartYear(int partYear) {
		this.partYear = partYear;
	}


	/**
	 * @return the partCapacity
	 */
	public String getPartCapacity() {
		return partCapacity;
	}


	/**
	 * @param partCapacity the partCapacity to set
	 */
	public void setPartCapacity(String partCapacity) {
		this.partCapacity = partCapacity;
	}


}


class ItemQuantity {
	private Item item;
	private int quantity;


	public ItemQuantity() {
	}


	public ItemQuantity(Item item, int quantity) {
		this.item = item;
		this.quantity = quantity;
	}


	/**
	 * @return the item
	 */
	public Item getItem() {
		return item;
	}


	/**
	 * @param item the item to set
	 */
	public void setItem(Item item) {
		this.item = item;
	}


	/**
	 * @return the quantity
	 */
	public int getQuantity() {
		return quantity;
	}


	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}


}


public class Main {


	public static void main(String[] args) {


	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS